Passing directory as compiler argument not finding file

Jamie nothanks at gmail.com
Thu Apr 12 07:48:28 UTC 2018


On Thursday, 12 April 2018 at 06:30:25 UTC, Tony wrote:
> On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote:
>
>> Am I using the -I compiler option incorrectly?
>
> I believe so. I think it is for finding import files, not the 
> files you are compiling.
>
> ---------------------------------------------------------
> -I=directory
>      Look for imports also in directory

Ahh yes I think you are correct. It sounds silly that I was 
compiling from a different spot to my file, but it was to 
demonstrate my situation. Really, it's more like:

A/
  a.d
     module A.a;
     import std.stdio;
     import B.b;
     void main()
     {
         writeln(f(4));
     }
B/
  b.d
     module B.b;
     size_t f(size_t input)
     {
         return input * 2;
     }

And in A/ I'm compiling
     dmd -ofoutput a.d ../B/b.d

and instead I was thinking I could compile with
     dmd -ofoutput a.d -I../B b.d

and would get the same result. The former works, the latter does 
not. Is there something like this that I can use or do I have to 
pass all the files with the direct path to them? Thanks



More information about the Digitalmars-d-learn mailing list