Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: kai on May 22, 2006, 07:33:59 pm

Title: [solved] linking problem where one static library uses another static library
Post by: kai on May 22, 2006, 07:33:59 pm
Hi,

I have a complex workspace where one static library uses another static library. the main program links both of these libraries. i get linker errors saying there are undefined references. this happens in a file from one library that calls a function of the other library - the function has been optimized out. however if i call that function in the main program it is also available to the other library - is there a clean solution for this setup? I'm on linux using gcc 4.0.3

Kai
Title: Re: linking problem where one static library uses another static library
Post by: Michael on May 22, 2006, 07:41:01 pm
Hello,

Did you try with project dependencies (Project-->Properties-->Targets-->Dependencies)?

Best wishes,
Michael
Title: Re: linking problem where one static library uses another static library
Post by: kai on May 22, 2006, 08:05:56 pm

I already had the library project in Project->Properties->Project Dependencies of the other library. I have now added the library file libG3D.a itself to Project->Properties->Targets->Dependencies->External Dependencies (btw. - i also always have to add the library there for automatic recompilation - the first dependency option doesn't really help/work). Doesn't help though - that option is probably just there for automatic recompilation.
Title: [solved]Re: linking problem where one static library uses another static library
Post by: kai on May 22, 2006, 09:14:59 pm
ok, works now. the library that uses another library has to be before the other one in the list of libraries to link. when dependencies are set correctly c::b could make some checks - but i would call this a minor problem.