Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: wanggeng on November 29, 2011, 05:23:54 pm

Title: building a static library can not link to a library
Post by: wanggeng on November 29, 2011, 05:23:54 pm
I am going to build a static library(libC6Lib.a), and this library has to be linked with a previous build library(test_head.lib).
I add the library file into [project options]->[linker settings]->[link libraries] and add library's path into [project options]->[search directories]->[linker].
I open the option "save build log to HTML file when build is finished".
However, I only get the following link command:

c6runlib_codeblock_ar -r -s libC6Lib.a obj/Debug/main.o

the test_head.lib is not in command line, and I can not remove the "-r" either "-s" option.

who can help me. Thank You!
Title: Re: building a static library can not link to a library
Post by: zabzonk on November 29, 2011, 05:41:45 pm
Static libraries do not link to other libraries - they are just archives of object files.
Title: Re: building a static library can not link to a library
Post by: wanggeng on November 30, 2011, 09:24:35 am
Well, Thank you. But my compiler is special, it need an library file to generate its library. How can I the set up the Code::Blocks IDE to generate command line like this:

c6runlib_codeblock_ar -r -s libC6Lib.a obj/Debug/main.o test_head.lib
Title: Re: building a static library can not link to a library
Post by: oBFusCATed on November 30, 2011, 01:36:08 pm
You can edit the compiler/linker commands in Settings->Compiler -> Your compiler -> Other settings -> Advanced