How to use the -I command line switch?

Tony tonytdominguez at aol.com
Wed Jan 3 21:42:01 UTC 2018


On Wednesday, 3 January 2018 at 18:35:21 UTC, Ali Çehreli wrote:
> On 01/03/2018 09:10 AM, tipdbmp wrote:
>>> dmd main.d C:\libs\my_module.d
>> That does not use the -I switch.
>> 
>> It compiles if I specify the full path to my_module.d:
>>      dmd -IC:\libs main.d C:\libs\my_module.d
>> 
>> I don't understand the error message though.
>> 
>
> -I is for import directives only. imports are needed to compile 
> the importing module. All other modules still need to be 
> compiled themselves and added to the program either as 
> individual .o files or as libraries (e.g. .a, .lib, etc.).
>
> The method you've shown is a shorthand for "compile each to .o 
> and add each to the program."
>
> Working as expected... :)
>
What about the error message? If -I is only for DMD finding 
"import ..." files, and not files on the command line, why does 
DMD list what was in the -I "where to look for import directives" 
when saying that it can't find a command-line file? It says that 
it can't locate my_module.d and then lists the directory that 
my_module.d is in.



More information about the Digitalmars-d-learn mailing list