Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Laethnes on February 01, 2010, 01:27:51 pm

Title: [SOLVED] Howto make C::B link library,when it was changed,but *.h files are not?
Post by: Laethnes on February 01, 2010, 01:27:51 pm
In one workspace, I have one project as a static library and a few projects as executable, which are linking the static lib. In Prosperites -> Project's dependencies I did set dependencies so that all executables are dependent on static lib, so when I click Build, the static lib is build first, then is build exe project and then is all linked, which works nice. Problem is, when I change some source in the static lib but NOT any header file and NOT any file in exe project, static lib is build but exe project is not re-linked. Is there any option I missed, that enables checking linked libs for change and re-link project?

- I make sure, that I'm switched on exe project
- It all works fine, if I change some header file, which is included in exe project or when I change some file in exe project

- CodeBlocks: SVN 6088 (but this occurs on 8.04 too)
- OS: Windows XP, GNU Linux Ubuntu 9.10, both 32bit
- compiler: on Win MinGW-gcc: 3.4.5, on Linux: actualized GNU GCC
Title: Re: Howto make C::B link library, when it was changed, but *.h files are not?
Post by: MortenMacFly on February 01, 2010, 02:59:58 pm
Is there any option I missed, that enables checking linked libs for change and re-link project?
Yes, it's called external dependencies:
(Right click on) Project -> Properties -> Tab "Build targets" -> button "Dependencies" -> Place a link to your library in "External dependency files" and read the comment in that dialog. ;-) Do this step for very (relevant) target.
Title: Re: Howto make C::B link library, when it was changed, but *.h files are not?
Post by: Laethnes on February 01, 2010, 05:57:55 pm
Is there any option I missed, that enables checking linked libs for change and re-link project?
Yes, it's called external dependencies:
(Right click on) Project -> Properties -> Tab "Build targets" -> button "Dependencies" -> Place a link to your library in "External dependency files" and read the comment in that dialog. ;-) Do this step for very (relevant) target.
Oh, thank you very much :), it's exactly I need.
Title: Re: [SOLVED] Howto make C::B link library,when it was changed,but *.h files are not?
Post by: richarduk on March 11, 2010, 07:01:22 pm
I had this same problem, has a pre build script that created some header files. The stated fix in this thread fixed my issue but should it not happen auto magically when you say that one project is dependent of another? Seems very counter intuitive.

Title: Re: [SOLVED] Howto make C::B link library,when it was changed,but *.h files are not?
Post by: tankist02 on August 20, 2011, 02:43:51 am
I agree - when a library is added to an executable project the library should be set as external dependency.
Title: Re: [SOLVED] Howto make C::B link library,when it was changed,but *.h files are not?
Post by: cacb on August 20, 2011, 06:43:17 pm
I agree - when a library is added to an executable project the library should be set as external dependency.

Indeed, I hope this will be the case soon in C::B.

See a very similar discussion here, suggesting the same http://forums.codeblocks.org/index.php/topic,14882.0.html (http://forums.codeblocks.org/index.php/topic,14882.0.html)