I am trying to pre-compose Boost headers.
The first experiment is with std :: headers. I create a std.hpp file:
#include <vector> #include <iostream> // And other std:: headers
After that:
g++ std.hpp
Copy the std.hpp.gch file to / usr / include / C ++ / 4.4.5
And write a test program:
#include <std.hpp> int main() { std::cout << "Hello, precompiled world!" << std::endl; return 0; }
It works great.
Now try precompiling the Boost headers.
I create a boost.hpp file:
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/karma.hpp>
After that:
g++ boost.hpp
Copy boost.hpp.gch to / usr / local / include / boost
And write a test program:
#include <boost/boost.hpp> int main() { // Some code... return 0; }
But there was an error:
main.cpp:2:33: error: /usr/local/include/boost/boost.hpp: No such file or directory.
Try, for an experiment:
#include </usr/local/include/boost/boost.hpp> int main() { // Some code... return 0; }
The same mistakes.
Try copying boost.hpp.gch to another location - the same error.
If I put the boost.hpp file in one place - it works fine (so there are no problems with the path):
ls /usr/local/include/boost | grep boost boost.hpp boost.hpp.gch
Therefore, the compiler uses the boost.hpp header. But why does the compiler not see the precompiled boost.hpp.gch ??