I need some help on using tango...
I'm a gentoo user (gcc-4.2.0, dmd-bin 1.014, tango 0.98)
This is the problem I'm trying to compile:
import tango.io.Console;
alias char[] String;
void main(String[] args)
{
Cout("Hello, world!").newline;
}
When I do "dmd hello.d" the program compiles and runs fine.
The following output is produced:
gcc hello.o -o hello -m32 -Xlinker /opt/dmd/lib/libtango.a -Xlinker -L/opt/dmd/bin/../lib -lphobos -lpthread -lm
/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
Now, Codeblock doesn't want to play nice with it...
After some time of playing with it, all I can get is:
-------------- Build: Debug in TestingProject ---------------
Linking console executable: bin/Debug/TestingProject
obj/Debug/hello.o:(.data+0x30): undefined reference to `_D5tango2io7Console12__ModuleInfoZ'
obj/Debug/hello.o: In function `_Dmain':
/root/projects/TestingProject/hello.d:8: undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output'
/root/projects/TestingProject/hello.d:9: undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output'
/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.
collect2: ld returned 1 exit status
I have a feeling it's a matter of doing something basic right, but please - it's quite frustrating not to be able to use codeblocks to compile. Thanks for your help :)
-Xlinker /opt/dmd/lib/libtango.a
This is just a guess - but are you sure you need -Xlinker ? AFAIK C::B compiles D code just like C++ code, meaning that it compiles each file into an object file and then calls the linker - if so you don't need -Xlinker
For full command :
Compiling: Settings -> Compiler and Debugger -> Tab "Other" -> Compiler logging = "Full command line".
(thanks to Morten's signature ;) )
Here's what DMD does:
gcc hello.o -o hello -m32 -Xlinker /opt/dmd/lib/libtango.a -Xlinker -L/opt/dmd/bin/../lib -lphobos -lpthread -lm
/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object
And in C::B
gcc -o bin/Debug/Test -m32 -Xlinker /opt/dmd/lib/libtango.a -Xlinker -L/opt/dmd/bin/../lib obj/Debug/hello.o -lpthread -lm -lphobos
obj/Debug/hello.o:(.data+0x40): undefined reference to `_D5tango2io6Stdout12__ModuleInfoZ'
obj/Debug/hello.o: In function `_Dmain':
........
Hmnnn. The order doesn't look correct.