4

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??

4
  • Maybe /usr/local/include is not in your include path. Try g++ -I/usr/local/include. Commented Mar 4, 2011 at 8:47
  • /usr/local/include is in my include path. In this path placed 'boost' dir. :-) And as I say, file boost.hpp in same path works fine, but boost.hpp.gch - not. Commented Mar 4, 2011 at 8:53
  • For experiment try g++ -I/usr/local/include - same error... Commented Mar 4, 2011 at 9:14
  • I try precompile separate boost-header: g++ /usr/local/include/boost/spirit/include/qi.hpp, after that remove qi.hpp from this place - same error. Commented Mar 4, 2011 at 9:27

1 Answer 1

3

This might be a gcc bug as documented in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46110

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.