User forums > General (but related to Code::Blocks)
Precompiled headers
valkenar:
Is it intentional that if the project is configured to compile a given header file that this header file will be compiled every build, whether or not it has changed? This seems to be the behavior, and I wasn't sure if this was intended behavior or whether I should report it as a bug.
This is relevant to me, because I use a custom build step that generates a cpp file, and it means that every build includes runnng the custom build step and also compiling the generated cpp files, even when they haven't changed. Is there a workaround for this?
Biplab:
If an header is configured to be compiled then it will create PCH file for GCC. But it won't be compiled in every build unless you make some changes to it.
If the cpp file is changed, then it shouldn't compile the header file or other files unnecessarily. :)
valkenar:
--- Quote from: Biplab on March 17, 2007, 05:35:53 pm ---If an header is configured to be compiled then it will create PCH file for GCC. But it won't be compiled in every build unless you make some changes to it.
If the cpp file is changed, then it shouldn't compile the header file or other files unnecessarily. :)
--- End quote ---
This seems not to be true. If I repeatedly build, I get this:
-
------------- Build: Debug in Program ---------------
Precompiling header: header1.h
Compiling: moc_header1.cpp
Linking console executable: bin\Debug\test.exe
Process terminated with status 0 (0 minutes, 4 seconds)
0 errors, 0 warnings
Every time I run a build.
Biplab:
My test results doesn't show that. ;)
--- Quote ----------------- Build: Release in Test ---------------
[ 20.0%] Precompiling header: wx_pch.h
[ 40.0%] Compiling: resource.rc
[ 60.0%] Compiling: TestMain.cpp
[ 80.0%] Compiling: TestApp.cpp
[100.0%] Linking executable: bin\Release\Test.exe
Process terminated with status 0 (0 minutes, 24 seconds)
0 errors, 0 warnings
-------------- Build: Release in Test ---------------
[ 50.0%] Compiling: TestApp.cpp <-- Only this file was changed
[100.0%] Linking executable: bin\Release\Test.exe
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
--- End quote ---
Your case may happen, if you Rebuild the project.
I agree that it's not perfect, but it works. :)
Regards,
Biplab
Alturin:
Wouldn't that be because rebuild = clean+build, so it'd have to rebuild the header file cos it got cleaned?
Navigation
[0] Message Index
[#] Next page
Go to full version