User forums > Using Code::Blocks

Header dependency in the build

<< < (2/3) > >>

mdzahidh:
Yes, both conditions are satisfied ! The situation is, the source tree has several directories.. so for example it has a directory called "volumes", see below

src
 |
 |----> volumes
              |
              |exponential.h
              |exponential.cpp

So both exponential.h and exponential.cpp are in the same folder "volumes." In the file "exponential.cpp" its written

#include "volumes/exponential.h"  // since the build is performed from the root directory "src"

but if i change/modify exponential.h then and then do a "build", it says "Nothing to be done" :(

zabzonk:

--- Quote ---yes, i checked the modification time and it is consistent with the system time. I modified the file from within CB and checked the modification time using "stat"
--- End quote ---

But are the times for the .cpp files that depend on the header consistent? In other words, are their times prior to that on the modified header?

mdzahidh:
Arright, i think i found a pattern here.

if in a .cpp file the headers are included without directory prefix for example

#include "someheader.h"

then modifying that header also triggers a recompilation of the source file :)

but if its written

#include "dir/someheader.h"

it fails to recognize the modifications in the header file :(

zabzonk:
As stahta01 asked - are you adding these header files to the project? The mere fact that a header exists somewhere on the system, even if it is on the include path does, not guarantee the dependency mechanism will do what you want.

mdzahidh:
yes, the headers are added in the project as well ! but i dont know if it is CB feature or not, the header files (in the project browser) is colored gray. Does that imply anything ?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version