www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import from the same dir

reply Alexandr <sashulika gmail.com> writes:
hello to all!
i have:
======systemsolver.d====
module systemsolver;
import std.stdio;
class SystemSolver
{
  this()
  {
    writefln("Constr!");
  }
}

===main.d==
import std.stdio;
import systemsolver;

void main(char[][] args)
{
  writefln("Hello World, Reloaded");
}
=====
these 2 files are in the same dir. When i try to compile main.d i get error:
user LMZ:/Coding$ dmd main.d 
gcc main.o -o main -m32 -Xlinker -L/home/user/dmd/bin/../lib -lphobos -lpthread
-lm 
main.o:(.data+0x38): undefined reference to `_D12systemsolver12__ModuleInfoZ'
collect2: ld returned 1 exit status
--- errorlevel 1
======
help me please!
Nov 26 2007
next sibling parent Daniel Keep <daniel.keep.lists gmail.com> writes:
Alexandr wrote:
 ...
 these 2 files are in the same dir. When i try to compile main.d i get error:
 user LMZ:/Coding$ dmd main.d 

You need to use: $ dmd main systemsolver DMD will only compile the files you *tell* it to compile. -- Daniel
Nov 26 2007
prev sibling parent bearophile <bearophileHUGS lycos.com> writes:
Alexandr Wrote:

 these 2 files are in the same dir. When i try to compile main.d i get error:
 user LMZ:/Coding$ dmd main.d 
 gcc main.o -o main -m32 -Xlinker -L/home/user/dmd/bin/../lib -lphobos
-lpthread -lm 
 main.o:(.data+0x38): undefined reference to `_D12systemsolver12__ModuleInfoZ'
 collect2: ld returned 1 exit status
 --- errorlevel 1
 ======
 help me please!

It's a silly limitation of DMD I hope to see solved soon. In the meantime this limitation can be written in the FAQ to warn newbies, and there are a couple of tools (I use one called "bud") that can solve that problem. Bye, bearophile
Nov 26 2007