User forums > Help
Precompiled Header Hell
sviten:
Hi guys,
I'm new to C::B. I was trying to import my code over (from Dev-cpp but I just imported the source files). I seem to have a problem where g++ refuses to use my header files unless they are precompiled and if I allow it to precompile them, then I get a "protocol.h.gch: file not recognized: File format not recognized" error after it compiles it.
Is there a way to turn off using precompiled headers? I can't find it either in the Project, Compiler settings or this forum.
I'm not very interested in using PCH since I'm still changing my headers a lot.
Thanks much for your time.
Urxae:
How exactly does it 'refuse' to use your header files? Does it seem to be using an old version? Does it give an error message?
One thing that might cause this: you have to remember to delete previously generated .gch files when switching the corresponding precompiled headers off, or GCC will keep using the .gch it finds.
Oh, and did you happen to upgrade GCC recently? "File format not recognized" sounds like the .gch was not generated by the current version of GCC (a .gch is basically a dump of the internal memory state of GCC, which can differ with each version).
sviten:
--- Quote from: Urxae on December 01, 2005, 10:44:36 pm ---How exactly does it 'refuse' to use your header files? Does it seem to be using an old version? Does it give an error message?
--- End quote ---
Sorry, guess I forgot to include that
If I go into the Properties setting for each header file in my project and uncheck "Compile" (this is the only way I would guess to tell g++ not to use precompiled headers), then g++ returns the error, "mingw32-g++.exe: protocol.h.gch: No such file or directory". How would I know if I was using an old version? I just downloaded it today.
--- Quote from: Urxae on December 01, 2005, 10:44:36 pm ---One thing that might cause this: you have to remember to delete previously generated .gch files when switching the corresponding precompiled headers off, or GCC will keep using the .gch it finds.
Oh, and did you happen to upgrade GCC recently? "File format not recognized" sounds like the .gch was not generated by the current version of GCC (a .gch is basically a dump of the internal memory state of GCC, which can differ with each version).
--- End quote ---
Check on the deleting old .gch files. Negative on the upgrade.
Urxae:
--- Quote from: sviten on December 02, 2005, 12:24:48 am ---
--- Quote from: Urxae on December 01, 2005, 10:44:36 pm ---How exactly does it 'refuse' to use your header files? Does it seem to be using an old version? Does it give an error message?
--- End quote ---
Sorry, guess I forgot to include that
If I go into the Properties setting for each header file in my project and uncheck "Compile" (this is the only way I would guess to tell g++ not to use precompiled headers), then g++ returns the error, "mingw32-g++.exe: protocol.h.gch: No such file or directory". How would I know if I was using an old version? I just downloaded it today.
--- End quote ---
By the 'old version' question I meant if GCC seemed to be using an old version of the header (which might happen if you forgot to delete the .gch).
It's specifically looking for protocol.h.gch? Weird. You wouldn't happen to have #included that .gch directly would you? I'm not even sure that would work, but that would explain the error...
If not, go to Settings -> Compiler -> Other, and set "Compiler logging" to "Full command line". Then try to compile. See if protocol.h.gch is mentioned in the command line ("-include protocol.h.gch" perhaps?).
If after that you still can't figure it out, please post the full build log here.
sviten:
No, I'm definitely not putting #include"protocol.gch" in my .cpp files. Here's my compile log (after running a dist-clean):
--- Code: ---Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : D:\Projects\GeccoTester\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c protocol.cpp -o .objs\protocol.o
mingw32-gcc.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c sha256.c -o .objs\sha256.o
mingw32-g++.exe -g -ID:\Projects\GeccoTester\ -I..\ptypes-2.0.2\include -I"d:\Program Files\CodeBlocks\include" -ID:\Projects\ptypes-2.0.2\include -c main.cpp -o .objs\main.o
mingw32-g++.exe -LD:\Projects\GeccoTester\ -L..\ptypes-2.0.2\lib -L"d:\Program Files\CodeBlocks\lib" -LD:\Projects\ptypes-2.0.2\lib -o D:\Projects\GeccoTester\GeccoTester.exe .objs\protocol.o protocol.h.gch .objs\sha256.o sha256.h.gch .objs\main.o ..\ptypes-2.0.2\lib\libptypes.a
mingw32-g++.exe: protocol.h.gch: No such file or directory
mingw32-g++.exe: sha256.h.gch: No such file or directory
Process terminated with status 1 (0 minutes, 11 seconds)
0 errors, 0 warnings
--- End code ---
It seems to be be looking for the *.h.gch files specifically. I think this is coming from here:
Navigation
[0] Message Index
[#] Next page
Go to full version