I try to precompile Boost headers.
First experiment - with std:: headers. I create file std.hpp:
#include <vector> #include <iostream> // And other std:: headers After that:
g++ std.hpp Copy std.hpp.gch in /usr/include/c++/4.4.5
And write test program:
#include <std.hpp> int main() { std::cout << "Hello, precompiled world!" << std::endl; return 0; } Works fine.
Now try precompile Boost headers.
I create boost.hpp file:
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/karma.hpp> After that:
g++ boost.hpp Copy boost.hpp.gch in /usr/local/include/boost
And write test program:
#include <boost/boost.hpp> int main() { // Some code... return 0; } But got error:
main.cpp:2:33: error: /usr/local/include/boost/boost.hpp: No such file or directory. Try, for experiment:
#include </usr/local/include/boost/boost.hpp> int main() { // Some code... return 0; } Same error.
Try copy boost.hpp.gch in another place - same error.
If I put file boost.hpp in same place - works fine (so there is no problems with path):
ls /usr/local/include/boost | grep boost boost.hpp boost.hpp.gch So compiler use boost.hpp header. But why compiler don't see precompiled boost.hpp.gch??
/usr/local/includeis not in your include path. Tryg++ -I/usr/local/include.g++ -I/usr/local/include- same error...g++ /usr/local/include/boost/spirit/include/qi.hpp, after that remove qi.hpp from this place - same error.