Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

problem compiling examples...

Moderators: larsivi kris

Posted: 02/25/07 20:29:37

Hi, i've installed tango as as far as i can tell it went well however i can't compile the examples that use tango.io.Console for instance.

the program: private import tango.io.Console,

tango.io.FileConduit?;

void main (char[][] args) {

if (args.length is 2)

{ // open a file for reading auto fc = new FileConduit? (args[1]);

// stream directly to console Cout.conduit.copy (fc); }

else

Cout ("usage is: filecopy filename");

}

results in:

dmd hello.d gcc hello.o -o hello -m32 -lphobos -lpthread -lm -Xlinker -L/usr/local/lib hello.o(.data+0x30): undefined reference to `_D5tango2io7Console12ModuleInfoZ' hello.o(.data+0x34): undefined reference to `_D5tango2io11FileConduit12ModuleInfoZ' hello.o(.gnu.linkonce.t_Dmain+0xe): In function `_Dmain': : undefined reference to `_D5tango2io11FileConduit11FileConduit7ClassZ' hello.o(.gnu.linkonce.t_Dmain+0x3b): In function `_Dmain': : undefined reference to `_D5tango2io11FileConduit11FileConduit12ReadExistingS5tango2io11FileConduit11FileConduit5Style' hello.o(.gnu.linkonce.t_Dmain+0x43): In function `_Dmain': : undefined reference to `_D5tango2io11FileConduit11FileConduit5_ctorMFAaS5tango2io11FileConduit11FileConduit5StyleZC5tango2io11FileConduit11FileConduit' hello.o(.gnu.linkonce.t_Dmain+0x49): In function `_Dmain': : undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output' hello.o(.gnu.linkonce.t_Dmain+0x69): In function `_Dmain': : undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output' collect2: ld returned 1 exit status

or

import tango.io.Console;

void main() {

Cout("Hello, World").newline;

}

results in: tord@todelod:~/workspace/HelloWorldD/src$ dmd hello.d gcc hello.o -o hello -m32 -lphobos -lpthread -lm -Xlinker -L/usr/local/lib hello.o(.data+0x30): undefined reference to `_D5tango2io7Console12ModuleInfoZ' hello.o(.gnu.linkonce.t_Dmain+0x10): In function `_Dmain': : undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output' collect2: ld returned 1 exit status --- errorlevel 1

any suggestions would be welcome..

my dmd.conf looks like:

[Environment] DFLAGS=-I/usr/local/include/tango/lib/common -I/usr/local/include/tango -L-L/usr/local/lib -version=Posix -version=Tango

Author Message

Posted: 02/26/07 08:42:39

This is due to missing dependencies on the command line to dmd, and the reason we recommend you to use a build tool like rebuild or bud.

Your commandline would then be something like

rebuild hello.d

plus any libraries you need to link (but you shouldn't need that for any of the tango examples).