www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Symbol undefined due to import statement

reply Andre <andre s-e-a-p.de> writes:
Hi,
there is a behaviour which seems strange for me.
I have following structure

C:\Projects\ProjectA\main.d
C:\Projects\Reusuable\net\http.d

The content of main.d is:
  module main;

  import std.stdio;
  import net.http;

  int main()
  {
	return 0;
  }

The content of http.d is:
  module net.http;

I compile the application with command:
dmd -IC:\Projects\Reusuable main.d

This works, but if I now edit the http.d file
and add an import statement like "import std.stdio;"
then the linker will output following error:

  main.obj(main)
  Error 42: Symbol Undefined _D3net4http12__ModuleInfoZ

Where is my error?

Kind regards
Andre
Aug 15 2011
parent reply torhu <no spam.invalid> writes:
On 15.08.2011 10:15, Andre wrote:
...
 I compile the application with command:
 dmd -IC:\Projects\Reusuable main.d

 This works, but if I now edit the http.d file
 and add an import statement like "import std.stdio;"
 then the linker will output following error:

    main.obj(main)
    Error 42: Symbol Undefined _D3net4http12__ModuleInfoZ

 Where is my error?

You need to add all your project's files to the command line: dmd -IC:\Projects\Reusuable main.d net\http.d
Aug 15 2011
parent Andre <andre s-e-a-p.de> writes:
Am Mon, 15 Aug 2011 10:24:38 +0200 schrieb torhu:

 dmd -IC:\Projects\Reusuable main.d net\http.d

Hi torhu, thanks a lot. This works. Kind regards Andre
Aug 15 2011