imports && -run [Bug?]

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 12 23:33:40 PDT 2016


On 2016-05-13 08:10, tsbockman wrote:

> According to the DMD compiler manual, the -run switch only accepts a
> single source file:
>      -run srcfile args...
>
> After the first source file, any further arguments passed to DMD will be
> interpreted as arguments to be passed to the program being run.

To elaborate, since the second file "inc" is not passed to the compiler, 
it will not compile that file, therefore you get linker errors. The 
solution is to pass all extra files before the -run flag.

Even better is to use "rdmd" which will automatically track and compile 
dependencies. Using rdmd it's enough to pass a single file to compile 
all dependencies and run the resulting binary: "rdmd mod".

> Have you tried using DUB? It has lots of convenient features, including
> a `run` command that supports multiple source files:
>      http://code.dlang.org/docs/commandline#run

Dub is a great tool when a project grows larger than a few files.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list