Is there a special trick to making precompiled headers work under CygWin?
I had read and followed the directions, but on testing I find that the .h file is always used and the .h.gch is never used. These are the directions I followed. The following directions are on the web but are the same as the ones on my hard disk for my CygWin version of g++.
http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html#Precompiled%20Headers
Here's the general idea of how I tested it in pseudo code. (I just typed the following from scratch without running it so it probably has typos When I did the test, I didn't actually use a DOS batch file and I don't actually have a program called 'replace.exe.' <G> I also didn't have any comments in any of the files.)
======= example =======
//--------------------- // file: pre.h
#include <iostream>
const int a = 4;
//--------------------- // file: main.cpp
#include pre.h
using namespace std;
int main(){
cout << a << endl;
}#---------------------- # file: makefile
main : main.o pre.h.gch
g++ main.o -o mainmain.o : main.cpp pre.h
g++ -c main.cpp -o main.o:gch
g++ -x c++ -c pre.h -o pre.h.gchrem-------------------- rem file: test.bat
rem Update precompiled header and make. make gch make
rem prints 4 main
rem Edits pre.h to assign '2' to 'a.' replace "pre.h" "4" "2"
rem Make without updating precompiled header. make
rem Prints 4 if precompiled headers are working rem or 2 if they are not working. main
====== end example ======
When I run 'test,' it always prints 4 then 4 for me. If precompiled headers were working, I would get 4 then 2.
Jeff _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
