Author Topic: Precompiled header  (Read 5585 times)

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Precompiled header
« 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

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Precompiled header
« Reply #1 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

Offline upCASE

  • Multiple posting newcomer
  • *
  • Posts: 16
    • http://www.upcase.de
Precompiled header
« Reply #2 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
OS: Win XP Pro, Linux, Mac, CE
wx: 2.6.0
Compiler: VC 7.1, gcc 3.4.2, eVC 4  - If it was hard to write it should be hard to read... - Try not! Do. Or do not. There is no try.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Precompiled header
« Reply #3 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.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Precompiled header
« Reply #4 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.
Be patient!
This bug will be fixed soon...

Offline troels

  • Multiple posting newcomer
  • *
  • Posts: 71
Precompiled header
« Reply #5 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