On Tuesday, 24 August 2021 at 23:30:22 UTC, Ruby The Roobster
wrote:
I changed test.d to be the same code as in the
HelloWorld.d(https://github.com/gtkd-developers/GtkD/blob/master/demos/gtk/HelloWorld.d)example that is provided by the GtkD github. Adding the comment to the top of the file and removing the .json doesn't change what happens. Dub runs the program, but an executable file doesn't pop up next to it. Running ./test in the terminal returns a no file or directory error. Another thing. Apparently dub run is the default command, but running dub run test.d gives an error that the package test could not be found. Same with dub build. Running dub test.d still works just fine, for some reason.
`
Yes, `run` is the default. But you are misunderstanding how dub
works. Neither `dub run` nor `dub build` accepts a source file.
These commands expect to find a dub.json/sdl in the current
directory. dub will then look for source files in a `source` or
`src` directory and will pass them all to the compiler.
In other words, given:
```
- projectDir
-- dub.sdl
-- source
--- app.d
```
Then you can:
```
cd projectDir
dub
```
This will build and run the application with the default
configuration. This is documented here:
https://dub.pm/getting_started.html
When you instead do `dub test.d`, dub looks for the configuration
in a comment at the top of the source file. It then will build
and run that file and any dependencies listed in the
configuration. That's documented here:
https://dub.pm/advanced_usage
But either way, if the app successfully compiles and executes,
you should be seeing an executable. If you could paste the source
of test.d here and specify which platform you're on, then maybe I
or someone else can take a look.