User forums > General (but related to Code::Blocks)

Precompiled header

(1/2) > >>

troels:
Hi,
I'm trying to make a precompiled header. It appears to be not possible currently?

I have these two one-line files:

precomp.h:
#include "precomp.cpp"

precomp.cpp:
#include "wx/wx.h"

I've added precomp.cpp to my project.
In precomp.cpp|Options|Advanced I change the output:

Compiler variable: CPP
Object file: precomp.o -> precomp.gch

When I select OK, the change I just made is lost:
precomp.cpp|Options|Advanced again says precomp.o, not precomp.gch

I guess that this is a bug. When the bug eventually goes away, will this work? Is this the way to create a precompiled header using CB?

I'm using finalbeta.

Greetings,
Troels

troels:
Nobody here using precompiled headers? Is gcc's precompiled header implementation bad or useless? gcc sure is slow, precompiled headers should improve on this immensely.

Greetings,
Troels

upCASE:
Hi!
There was a discussion about this over at the wxWidgets forum. Maybe this helps:
http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2107

mandrav:
AFAIK, you don't need to have a cpp file to create a precompiled header.
Put in precomp.h:

#include "wx/wx.h"

and compile this to precompiled header using:

--- Code: ---mingw32-g++ [flags_go_here] -c precomp.h -o precomp.gch
// The compilation flags **must** be the same with those that were used to compile the project
--- End code ---

This will create precomp.gch which is a precompiled header.
In your projects just include precomp.h as usual. According to the GCC manual, if a .gch file is found, it is used instead of the .h file...

HTH,
Yiannis.

mandrav:

--- Quote ---Compiler variable: CPP
Object file: precomp.o -> precomp.gch

When I select OK, the change I just made is lost:
precomp.cpp|Options|Advanced again says precomp.o, not precomp.gch

I guess that this is a bug.
--- End quote ---

It is a bug alright, but not because it didn't save your changes. It shouldn't be allowed to change. It should be a static text instead of a text control...
It's just there for information. At the early stages it was possible to change it, but not anymore...

For precompiled headers, support will be added so you wouldn't have to tinker with this setting, even if it was possible to.
Please submit a feature request for precompiled headers, or else it will be forgotten if it only stays here...

Yiannis.

Navigation

[0] Message Index

[#] Next page

Go to full version