GtkD Blog Now Up and Running

Johannes Loher johannesloher at fg4f.de
Tue Jan 29 22:29:20 UTC 2019


Am 29.01.19 um 22:47 schrieb Ron Tarrant:
> And this goes in the same folder as the code file. And then... what? I
> type: dub?

The code file should be in a subfolder called "source". This is
customizable, but this is the default. So the folder structure should
look something like this:

├── dub.sdl
└── source
    └── app.d

By default, if there is a source file called "app.d" or "main.d", dub
will assume that your application is an exectuable and build it
accordingly (if targetType is not explicitly set to something else in
your dub.json or dub.sdl file).

If you don't want to have a source file named like that, you will need
to tell dub explicitly to build an executable (if that is what you want)
by adding the line
```
targetType "executable"
```
to your dub.sdl.

The easiest way to actually see how the basic folder structure should
look like is to simply call `dub init` in an empty folder. This will
interactively set up a basic project in that directory. During the
interactive process, you can set some properties for your project, e.g.
if you want to use a dub.sdl or dub.json file, add dependencies, choose
the name of the project etc. It really works in a straightforward way.

To actually build the project, simply run `dub build` from the project's
root folder. this will create a binary in the projects root folder with
the name specified in the dub.sdl file.

You can also run the project directly after compiling by running `dub
run` (or simply just `dub`, which does the same thing) from the projects
root folder.

All of this assumes that dub is actually installed and available on your
PATH.



More information about the Digitalmars-d-announce mailing list