How does the compiler look for the files of imports?

Derek Parnell derek at psych.ward
Thu Sep 20 04:19:56 PDT 2007


On Wed, 19 Sep 2007 00:19:46 +0200, Jakob wrote:

> 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?

Are you saying that the compiler should always treat the parent of the
current directory as a search root?

One simple workaround is to add "-I.." to the compiler configuration file. 

I have this in my default bud.cfg file, for example.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list