0

I'm using precompiled headers on a Qt project to speed up compilation time. I'm using Qt 4.6.2 .When I compile the project using macx-g++ (meaning the g++ compiler) it doesn't include the stdafx.h automatically for each header. When compiling under xcode it will work. I'm using the PRECOMPILED_HEADER qmake constant to point at my stdafx.h.

So is it a limitation from g++? Or there a solution/work around?

Thanks for your help, Boris -

Boris Gougeon
  • 864
  • 2
  • 11
  • 23

1 Answers1

0

Sometimes gcc ignores precompiled header if some conditions aren't met. see: gcc documentation page.

Compile headers just like any other files but put the output inside a file with a suffix of .gch:

g++ -c stdafx.h -o stdafx.h.gch
g++ main.cpp
./main.out

Pie_Jesu
  • 1,894
  • 3
  • 16
  • 30