Trouble with modules

Andrew Madigan amadigan at gmail.com
Sat Apr 15 01:27:44 PDT 2006


Derek Parnell wrote:

> On Sat, 15 Apr 2006 16:19:36 +1000, Andrew Madigan <amadigan at gmail.com>
> wrote:
> 
>> I have a file called HttpCommon.d where I am throwing code that needs to
>> be
>> imported by a few files in my project. It contains an enum and a few
>> constants. When I try to to import it, I get the following error:
>>
>> Request.d:5: module HttpCommmon cannot read file 'HttpCommmon.d'
>>
>> HttpCommon.d (in the same directory) contains:
> 
> There is a restriction in D in that one cannot have a module with the same
> name as the directory it appears in. The simple workaround is to rename
> one or the other.
> 

hmmm, maybe I am misunderstanding, but the directory these files are in is
called "dhttp" (I'm on linux, so the path is really just ~/dhttp). The file
structure looks like this:

dhttp
        Request.d
        HttpCommon.d
        [other d files]
        Makefile

Does HttpCommon need to be in a subdirectory? I admit I find all this a
little confusing, Java handles things a little differently.



More information about the Digitalmars-d-learn mailing list