Hei Chan <structurechart@xxxxxxxxx> writes: > Even closer this time. > The B.cpp file only has one line -- #include "B.h" > Instead of using the gch file generated by the g++ command in the make file. > I manually ran: > g++ -fPIC -O -O3 -DUSING_PCH -D_REENTRANT -I"/usr/local/include/boost" > -I"/usr/local/." -I"/opt/xerces-c-3.1.1/src" -x c++-header A/B.h.gch > A/B.h > > Then, I compiled my own project with "-include A/B.h" in Eclipse, I got > cc1plus: warning: /opt/3rdPartyLib/src/A/B.h.gch not used because A/B.h.gch created with -gnone, but used with -gdwarf-2 > > Then, I recompiled the gch file with -gdwarf-2, and recompiled my project again, I got: > cc1plus: warning: /opt/3rdPartyLib/src/A/B.h.gch not used because > `_REENTRANT' is not defined > > Then, I recompiled the gch file with -D_REENTRANT, and recompiled my > project again, I got: > cc1plus: warning: /opt/3rdPartyLib/src/A/B.h.gch not used because > `__NO_INLINE__' is defined > > I just wonder whether there is a simple way to use a precompiled header.... Use exactly the same command line when you create the precompiled header as when you use it. In this case, given the above command line, that means using -fPIC -O3 -DUSING_PCH -D_REENTRANT when you want to use the precompiled header. Ian