Hello,

I'm having some trouble using precompiled (gch) files. I searched extensively, but only found http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html which didn't help me much.

  I have the following directory structure:
/home/efrat/gch
  /home/efrat/gch/include/a.cpp
    /home/efrat/gch/include/detail/hd.hpp
  /home/efrat/gch/build/makefile

The content of a.hpp is:
___
#include "precomp_hd.h"


int
        main
        ()
{
        foo();
}
___


The content of hd.hpp is:
___
#include <iostream>


using namespace std;


void
        foo
        ()
{
        cout << "Hooray!" << endl;
}
___


The content of makefile is:
___
comp = g++
comp_warn_flags = -Wall
include_dirs = -I/home/efrat/gch
base_dir = /home/efrat/gch


precomp_hd.h.gch:
$(comp) $(comp_warn_flags) $(include_dirs) -o $(base_dir)/include/precomp_hd.h.gch -xc++ -c $(base_dir)/include/detail/hd.hpp


a.out: precomp_hd.h.gch
$(comp) $(comp_warn_flags) $(include_dirs) $(base_dir)/include/a.cpp -o a.out
___


But when I try to build a.out, I get:
___
error: precomp_hd.h: No such file or directory
___


So I don't understand how to get the cpp to use the precompiled header. I played around a lot with different includes, directory locations and stuff - all with the same result.

If someone could tell me what I'm doing wrong, I'd appreciate it very much. Alternatively, if someone could just point me to some simple working example of using gchs (which I couldn't find myself), that would be fine as well.

  Many Thanks!

  Efrat
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to