Why does file order matters when using -run option?

Adam D. Ruppe destructionator at gmail.com
Wed Mar 14 14:48:59 UTC 2018


On Wednesday, 14 March 2018 at 14:44:24 UTC, Marc wrote:
> Why does -run fail here? I thought it was a shorthand to this 
> batch:

Check the help text:

$ dmd -h
   dmd [<option>...] -run <file> [<arg>...]
   <arg>            Argument to pass when running the resulting 
program

Notice that there's only one file there. Everything after it is 
passed as args to the resulting program. So dmd -run cannot 
support multiple D files.

Though, with the new `-i` option you might be able to get it to 
infer modules.

dmd -i -run file_with_main.d args_to_main.......

and if it can locate the other modules automatically it should 
bring them in there.


More information about the Digitalmars-d-learn mailing list