www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import resolution

reply RandyH <me me.com> writes:
I've been playing with D on and off for a couple of years now, but now i'm
taking a more serious look at it.

So far things have generally gone well, but now i'm encountering an import
resolution issue.  In my source, I import tango.core.Thread and compile with:

dmd main.d -IC:\dmd\tango\import\tango\core

and get the following error:

main.d(4): module Thread cannot read file 'tango\core\Thread.d'

Well Thread is an interface file, not a source file.  According to the docs,
the compiler looks for interface files first then source files but yet doesn't
seem to be able to find it.  

In fact i've encountered more occasions where i've specified the import dir on
the command line but dmd is unable to see the file, but this one is my main
stumbling block right now.

Any ideas?
Oct 13 2007
next sibling parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
RandyH wrote:
 I've been playing with D on and off for a couple of years now, but now i'm
taking a more serious look at it.
 
 So far things have generally gone well, but now i'm encountering an import
resolution issue.  In my source, I import tango.core.Thread and compile with:
 
 dmd main.d -IC:\dmd\tango\import\tango\core
 
 and get the following error:
 
 main.d(4): module Thread cannot read file 'tango\core\Thread.d'
 
 Well Thread is an interface file, not a source file.  According to the docs,
the compiler looks for interface files first then source files but yet doesn't
seem to be able to find it.  
 
 In fact i've encountered more occasions where i've specified the import dir on
the command line but dmd is unable to see the file, but this one is my main
stumbling block right now.
 
 Any ideas?
 
Have you tried using -IC:\dmd\tango\import ? I am fairly certain that it's going to look for "tango.core.Thread" in {list of import paths}\tango\core\Thread.{di,d} -- Daniel
Oct 13 2007
parent RandyH <me me.com> writes:
Daniel Keep Wrote:

 
 
 RandyH wrote:
 I've been playing with D on and off for a couple of years now, but now i'm
taking a more serious look at it.
 
 So far things have generally gone well, but now i'm encountering an import
resolution issue.  In my source, I import tango.core.Thread and compile with:
 
 dmd main.d -IC:\dmd\tango\import\tango\core
 
 and get the following error:
 
 main.d(4): module Thread cannot read file 'tango\core\Thread.d'
 
 Well Thread is an interface file, not a source file.  According to the docs,
the compiler looks for interface files first then source files but yet doesn't
seem to be able to find it.  
 
 In fact i've encountered more occasions where i've specified the import dir on
the command line but dmd is unable to see the file, but this one is my main
stumbling block right now.
 
 Any ideas?
 
Have you tried using -IC:\dmd\tango\import ? I am fairly certain that it's going to look for "tango.core.Thread" in {list of import paths}\tango\core\Thread.{di,d} -- Daniel
Bingo. That did it. Thanks alot. I'm still getting used to imports resolving to actual path names.
Oct 13 2007
prev sibling parent BCS <ao pathlink.com> writes:
Reply to RandyH,

 I've been playing with D on and off for a couple of years now, but now
 i'm taking a more serious look at it.
 
 So far things have generally gone well, but now i'm encountering an
 import resolution issue.  In my source, I import tango.core.Thread and
 compile with:
 
 dmd main.d -IC:\dmd\tango\import\tango\core
 
try dmd main.d -IC:\dmd IIRC you need to give the root of the module tree as the import path. I think in C it is the same. If you want to include c:\foo\bar\baz.h using #include<bar\baz.h> then you need to have c:\foo in the import dir list.
Oct 13 2007