Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: troels on May 17, 2005, 01:31:49 pm

Title: Precompiled header
Post by: troels on May 17, 2005, 01:31:49 pm
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
Title: Re: Precompiled header
Post by: troels on May 30, 2005, 02:07:58 pm
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
Title: Precompiled header
Post by: upCASE on May 30, 2005, 02:44:52 pm
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
Title: Precompiled header
Post by: mandrav on May 30, 2005, 02:50:08 pm
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: [Select]
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

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.
Title: Precompiled header
Post by: mandrav on May 30, 2005, 02:53:46 pm
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.

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.
Title: Precompiled header
Post by: troels on May 30, 2005, 04:22:58 pm
Quote
support will be added so you wouldn't have to tinker with this setting

Ok! I'll go submit a feature request.

Regards,
Troels