How does the compiler look for the files of imports?

Gregor Richards Richards at codu.org
Tue Sep 18 16:27:42 PDT 2007


BCS wrote:
> Reply to Jakob,
> 
>> I have the following files:
>>
>> foo/bar.d
>> module foo.bar;
>> import lol.rofl;
>> lol/rofl.d
>> module lol.rofl;
>> If i change to the directory where "foo" and "lol" are in, and do
>> gdc foo/bar.d lol/rofl.d
>> it finds all the files.
>> If i change to the directory "foo/" and do
>> gdc bar.d ../lol/rofl
>> it doesn't compile:
>> bar.d:3: module rofl cannot read file 'lol/rofl.d'
>>
>> IMHO, the compiler should notice that the module name is 'foo.bar'
>> (and not only 'bar') and so the directory to search for imports is the
>> parent directory. Or what do you think about that?
>>
> 
> vote += bigNum;
> 
> 

vote -= bigNum;

The compiler should not trounce all over your file system if you give it 
a broken module name. It's your responsibility to arrange your source 
such that the compiler can find it, not the compiler's responsibility to 
seek it out.

  - Gregor Richards



More information about the Digitalmars-d mailing list