User forums > Using Code::Blocks
Does not recompile changed header files?
carra:
I suspect this is happening when the header being included in the project is in another folder. I use a separate folder to keep all headers so they can be all by included by other projects from the same location.
I'll try to upload a simple example later.
carra:
I have been investigating this and, ironically, what I have actually found (so far) is a case of the opposite! A project that keeps being rebuilt even when no files had been touched.
On every click on Rebuild I keep getting this message...
--- Quote ----------------- Build: Release in RebuildTest (compiler: GNU GCC Compiler)---------------
g++.exe -L. -LC:\Programacion\KTools\Libraries -o .\RebuildTest.exe .\Main.o -s -static-libgcc -static-libstdc++
Output size is 7.50 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
--- End quote ---
In other projects I have, it just shows the typical "Nothing to be done" message, but in this one it never happens...
What I have seen that happens here, is that the object file is never touched (last modification time keeps constant), but exe file keeps being relinked for some reason.
Attached is a simple project where I have this happening. Let's see if you can reproduce it
EDIT: I have found that this only happens when I turn on the "use flat objects" compiler option. Turning it off stops relinking and shows the "Nothing to be done" message.
[attachment deleted by admin]
carra:
Aargh! I needed WAY too much time to isolate the problem (I'm working with whole workspaces now), but I have finally attached a single project that does NOT recompile properly on header changes, even with "use flat objects" option turned off.
The project consists of 3 files:
- General.hpp
- LogStream.hpp
- LogStream.cpp
Any changes in the CPP file or LogStream.hpp trigger a recompile.
But changes General.hpp do not produce recompile, and instead the "Nothing to be done" message appears.
This has been tested on latest nighlty a.k.a. build 8059.
stahta01:
--- Quote from: carra on June 20, 2012, 04:27:09 pm ---Aargh! I needed WAY too much time to isolate the problem (I'm working with whole workspaces now), but I have finally attached a single project that does NOT recompile properly on header changes, even with "use flat objects" option turned off.
The project consists of 3 files:
- General.hpp
- LogStream.hpp
- LogStream.cpp
Any changes in the CPP file or LogStream.hpp trigger a recompile.
But changes General.hpp do not produce recompile, and instead the "Nothing to be done" message appears.
This has been tested on latest nighlty a.k.a. build 8059.
--- End quote ---
--- Code: ---C:\Users\stahta01\Downloads\KTools2\KTools2\Sources\LogStream\..\..\Headers\LogStream.hpp|10|fatal error: ..\..\Headers\General.hpp: No such file or directory|
--- End code ---
FYI: To get it to compiler, I had to change global compiler setting.
Build options: "Explicitly add currently compiling file's location to search dirs." to be checked
NOTE: I then did NOT see the described problem. Tested with self compiled SVN 8060
Tim S.
PS:
The below is considered bad style
--- Code: ---#include "..\..\Headers\General.hpp"
--- End code ---
Preferred style is using "/" instead of "\"
--- Code: ---#include "../../Headers/General.hpp"
--- End code ---
carra:
--- Quote from: stahta01 on June 20, 2012, 04:32:34 pm ---FYI: To get it to compiler, I had to change global compiler setting.
Build options: "Explicitly add currently compiling file's location to search dirs." to be checked
--- End quote ---
You are right on that, I always have "." as a search directory for the compiler. Still, I believe it should have worked. Including "header.h" (with quotes) is expected to be searched in the source file's directory, as stated here: http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html
Anyway, this doesn't have to do with the recompile issue I mentioned. Let's see if someone else experiences it too
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version