Hello, Greg wrote:
> It appears that in order for a precompiled header (.h.gch) to be used, > it has to reside in the same directory as the source header (.h) that > it was created from. This is somewhat cumbersome for builds that have > object files placed in a separate directory tree (as is the case with > autoconf, etc). This is a little nasty problem I had earlier, a cross interaction with the confusion about include "..." and include <...>. If you write in myfile.cc #include "myfile.h" when compiling, the directory of myfile.cc, will be searched first. If the precompiled header is missing there, search will end there and the .h will be used. With #include <myfile.h> the source directory won't be searched first, and the precompiled header will be found, if -I . comes before -I sourcedir. Alternatively, with an option -include myfile.h before all -I options the precompiled header myfile.h.gch in the build dir will be found as well. > Given, however, that this is the behavior, here is my problem. I > would > like to compile my libraries twice, once with -g and once without. > The object files from each build would be placed in a separate build > directories. But what happens to precompiled headers, which would > reside in the source tree, next to their .h file? Does a .h.gch file > need to be recompiled dependending on whether -g/-O are used? See the info pages, it's too much to write it down here, see e.g.: http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html Bernd Strieder _______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
