module import rules

module via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 25 12:59:28 PST 2015


Hello,

I have a main.d file which looks like this;

import somepackage.somemodule;

void main()
{
         printSomething();
}


Next to maind.d I have a directory 'somepackage' with a file 
inside called 'somemodule.d' which looks like this;

void printSomething()
{
         import std.stdio : writeln;

         "Hello".writeln;
}

Inside the main.d's folder I type;

dmd main.d somepackage/somemodule.d

and I get the following error message;
main.d(1): Error: module somemodule from file 
somepackage/somemodule.d must be imported with 'import 
somemodule;'

But I'm failing to understand why?

Thanks!




More information about the Digitalmars-d-learn mailing list