User forums > Using Code::Blocks
linking order [SOLVED]
Leviathan:
Hi, and sorry if this was asked before. I did a search but didn't find anything.
In my current project, I get a lot of undefined references when compiling with gnu gcc. With Visual C++ 2005 it works, and the functions are definitively there, so I assume the order in which codeblocks passes the object-files to the linker is wrong, but neither can I see the command-line that codeblocks is executing, nor have I found a way to change the order.
Any ideas? Thanks in advance
TDragon:
--- Quote from: Leviathan on May 31, 2006, 01:56:30 pm ---...neither can I see the command-line that codeblocks is executing, ...
--- End quote ---
Settings -> Compiler and debugger -> Other -> Compiler logging -> Full command line.
Invaluable for troubleshooting these issues.
Balazs:
Object files order doesn't matter, the only thing that does matter is the order of libs.
At the end of the list should be that lib, that doesn't use any symbols from the others.
For example: -l1 -l2 -l3
if
-l1 uses symbols from -l2 or -l3 (or both)
-l2 uses symbols from -l3
-l3 doesn't use symbols from the others
--
Greets,
B.
Michael:
--- Quote from: Leviathan on May 31, 2006, 01:56:30 pm ---Hi, and sorry if this was asked before. I did a search but didn't find anything.
In my current project, I get a lot of undefined references when compiling with gnu gcc. With Visual C++ 2005 it works, and the functions are definitively there, so I assume the order in which codeblocks passes the object-files to the linker is wrong, but neither can I see the command-line that codeblocks is executing, nor have I found a way to change the order.
Any ideas? Thanks in advance
--- End quote ---
Hello,
Which C::B revision are you using?
Best wishes,
Michael
Leviathan:
Hi,
thanks for your answers. I found the problem: One of the files (the one with the undefined references) was being compiled with g++, the rest with gcc so I guess the problem had to do with name-mangling or something.
Anyway, the full command line-logging showed me my mistake.
Btw.: I noticed that for the linking-step, g++ is used. Is this hard-coded or is this again a misconfiguration on my part? Doesn't seem to cause problems, just wondering.
Navigation
[0] Message Index
[#] Next page
Go to full version