User forums > Using Code::Blocks
Dependencies to static libs don't work?
raybert:
--- Quote from: cacb on December 10, 2008, 12:03:54 am ---I thought that when using Project Dependencies I would have an automatic dependency to the lib file as you explain. But it certainly does not work here (I am using build 5309 on Windows and Kubuntu). It seems odd to have to declare a project dependency AND declare external dependency to the project lib for every build target?
--- End quote ---
Not only that but you also have to add the lib (in the case of a static lib) to the linker list or it won't link against it.
I admit that I expected Project Dependencies to handle dependency checking and linking automatically when the dependency is another CB (static lib) project.
~ray
edwin:
jens,
I was building/debugging code this morning and also came across this behavior. I am using trunk SVN 6564.
I have a project that builds a shared library that is also dependant on other static libraries (also my own). I have a “main” workspace that I use for all the projects that sets up the project dependencies (the build order). Nice.
Your suggestion regarding “external dependency files” works beautifully to force a relink of my shared library when one of the other static libraries changes. I am glad this capability exists.
I have to agree however with cacb’s December 10, 2008 post. If we set up a build dependency (build order), that should also imply that the final target get relinked if any of the depandancy output images change. Having to do this manually is an extra step and a bit cumbersome when having a project with many build targets (debug, release, trial_debug, trial_release) not to mention supporting multiple platforms (Windows, Linux and OS X). I do not think setting up a dependency should also “auto link” with the dependency. We should always have to manually specify static libs we need to link against. All the dev tools I have used in the past 26 years have pretty much worked this way… and it might help to simplify the C::B developer experience.
I hope this information is helpful. I think C::B is great and my only wish is to see it get better.
Thank you,
edwin
oBFusCATed:
I've argued the same thing with Morten and he said it would be impossible to implement the auto-mumbo-jumbo for all compilers that C::B supports. I think it is possible, but I've no desire/need to implement this feature. :)
Probably you could write a script that could set the options and still leaves you in full control.
MortenMacFly:
--- Quote from: oBFusCATed on September 03, 2010, 06:23:19 pm ---I've argued the same thing with Morten and he said it would be impossible to implement the auto-mumbo-jumbo for all compilers that C::B supports.
--- End quote ---
I am not saying it is impossible, but I actually don't want such auto-magic and I bet I am not the only one. In fact I never understood why MSVS does such things and in fact what's done in MSVS is not something clever but linking against all available libraries in the end and let the linker choose what's right. Look what you#ll find in nearly every MS project:
--- Code: ---# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
--- End code ---
(...just try to google for it...). So why do I need to link against winspool or odbc if I do a hello world application?! I don't think that's a good thing to do... really.
However, If I got that topic right this is a rather different problem: It means that you want to link against your own libraries if they've changed, so only within your project / workspace. This is something worth to discuss. But I really wouldn't want to do such for system libraries.
oBFusCATed:
Hm, I've never wanted C::B to resolve the system libraries my project is using.
But, I want automatic linking for my projects, this should be doable and is done in VS (works without problems).
Probably the most annoying thing is the external deps setup, if that is automated the other is OK.
p.s. here is a link to the old thread: http://forums.codeblocks.org/index.php/topic,11905.msg81001.html
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version