User forums > Using Code::Blocks
Include a static lib into another ?
Kalith:
Hi there !
Yesterday, I had to compile some static library (OIS, for mouse and kb input) working with DirectInput (which is a static lib too). It compiled fine, but when I included it in my project, I had to link to the DirectInput library also.
That didn't please me, so I searched for a way to "include" DirectInput into the OIS library.
I managed to do it with the command line, by extracting the content of the DInput lib and using "ar" to archive it with the OIS object files. It works fine, but I was wondering if there was a way to do this directly in Code::Blocks ?
I mean, when building a static library, it seems that Code::Blocks doesn't look at the additional libraries provided in the project's build options. I guess this is a normal behavior, considering a static library is only linked when building an executable or a DLL (if I understood it well...), but couldn't these be plainly "included" in the resulting library ?
I've compiled OIS with Visual C++ also, and in this IDE they have an "additional dependencies" field where you can put other libs to be included in the resulting one.
Hope I was clear, and thanks for you help.
Kalith:
I don't like bumping threads, but I though this was an easy answer :) Nobody ?
stahta01:
What Compiler/Linker?
Add the needed options needed to the extra linker settings.
If added steps, add the steps to post step.
You used a lot of words to give very very little information.
Tim S.
Kalith:
I'm using g++ and its default linker (ar.exe).
I've configured CB to display the build log in full command line, and if I add a custom command to the linker by using the project's "Build options -> Linker Settings -> Other linker options", it doesn't show up.
Same thing if I add a library to link with.
It's like CB "forgets" the linker options when compiling static libraries (of course, everything works fine when compiling DLLs or executables).
--- Quote ---You used a lot of words to give very very little information.
--- End quote ---
English is not my native language, I apologize...
stahta01:
--- Quote from: Kalith on November 25, 2009, 08:31:19 pm ---It's like CB "forgets" the linker options when compiling static libraries (of course, everything works fine when compiling DLLs or executables).
--- End quote ---
What version/SVN of Code::Blocks?
This issue of forgetting settings happened to someone else; may be a bug in Code::Blocks.
What is the exact option you put in extra settings?
Certain ones go away because they should be put in regular option section.
The rules to make them go away might be wrong, changed or need fixing.
Tim S.
Navigation
[0] Message Index
[#] Next page
Go to full version