Author Topic: [SOLVED] Howto make C::B link library,when it was changed,but *.h files are not?  (Read 7425 times)

Offline Laethnes

  • Multiple posting newcomer
  • *
  • Posts: 12
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
« Last Edit: February 01, 2010, 05:58:21 pm by Laethnes »
(I'm sorry for errors in my English - it isn't my native language)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Howto make C::B link library, when it was changed, but *.h files are not?
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Laethnes

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Howto make C::B link library, when it was changed, but *.h files are not?
« Reply #2 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.
(I'm sorry for errors in my English - it isn't my native language)

Offline richarduk

  • Multiple posting newcomer
  • *
  • Posts: 10
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.


Offline tankist02

  • Multiple posting newcomer
  • *
  • Posts: 10
I agree - when a library is added to an executable project the library should be set as external dependency.

Offline cacb

  • Lives here!
  • ****
  • Posts: 539
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