User forums > Help
[D Programming] Using Codeblocks with Tango
Vladsharp:
--- Quote from: afb on May 25, 2007, 07:55:32 pm ---
--- Quote from: Vladsharp on May 25, 2007, 07:54:08 am ---I realise that, but that's what dmd does (I've posted its output from the CLI above) - and since the program runs fine, what do you suggest?
--- End quote ---
It seems that your command-line call to DMD is linking in libtango.a, but that Code::Blocks does not ?
--- End quote ---
Yes, it seems like that. When I add "-Xlinker /opt/dmd/lib/libtango.a -Xlinker -L/opt/dmd/bin/../lib" to C::B linker options, it still comes with the error.
Is there a way to see the full command line arguments for dmd/gcc linker?
Auria:
--- Quote ----Xlinker /opt/dmd/lib/libtango.a
--- End quote ---
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 ;) )
Vladsharp:
--- Quote from: Auria on May 26, 2007, 04:45:27 pm ---
--- Quote ----Xlinker /opt/dmd/lib/libtango.a
--- End quote ---
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 ;) )
--- End quote ---
Here's what DMD does:
--- Code: ---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
--- End code ---
And in C::B
--- Code: ---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':
........
--- End code ---
Hmnnn. The order doesn't look correct.
Vladsharp:
Solved the problem - as I guessed, it was the order of command-line options...
In C::B, the default for linking D programs is: "$linker -o $exe_output $link_options $link_objects $libs"
But the program links only correctly with: "$linker $link_objects -o $exe_output $link_options $libs"
Can this be made default in C::B because I suspect it's not just me that could pop into the problem some day with the dmd compiler...?
Navigation
[0] Message Index
[*] Previous page
Go to full version