User forums > Using Code::Blocks
Precompiling headers using GCC doesn't work
(1/1)
kbluck:
Using Code::Blocks 8.02
I'm attempting to precompile a header using GCC to a GCH target. In my project, the header in question is selected for compilation, but not linking. The command-line which is generated by Code::Blocks during the build is:
--- Code: ---g++ -Wall -g -Winvalid-pch -include "lib/precompile.hpp" -c /lib/precompile.hpp -o lib/precompile.h.gch
--- End code ---
This produces the notification:
--- Code: ---g++: lib/precompile.hpp: linker input file unused because linking not done
--- End code ---
... and the .gch target is not generated.
It appears that the option
--- Code: ----x c++-header
--- End code ---
is not being inserted into the GCC command line to inform the compiler that it is generating a precompiled header rather than an obj. When I manually add that option before the -c the compile succeeds, producing the expected .gch file.
Can anybody point out to me what I am failing to specify correctly in the project properties or build options? I can't find any obvious way to tell Code::Blocks that this file should be compiled a bit differently than the average .cpp file except by specifying a custom build command.
Thanks,
--- Kevin
Navigation
[0] Message Index
Go to full version