1

Running on an older version of rhel with an fairly old version of boost in /usr/include/boost. Installed a more modern version of boost and added the appropriate -I option to g++ so that it almost always goes to the new directory for boost headers. The problem is that a lot of the code base was written years ago for older versions of boost and includes headers that don't exist in a more modern boost. In this case, cpp happily includes the header from /usr/include/boost. What's the best way to avoid this? I'd rather not change #include <boost/file.hpp> to explicitly point to a different place unless I have to and am more than happy to clean up code that relied on extinct headers if I only knew what they were. And this could be an ongoing problem as some of the programmers working on the project might by habit include extinct headers, so simply checking once isn't enough.

3
  • Can you remove the old copy of boost and replace it with the new one? That's what I did on my RHEL systems. Commented Oct 19, 2012 at 19:32
  • You could either fix the sources or create duplicate empty header files in a separate "fake directory" and add that to gcc -Ifakedir ... Commented Oct 19, 2012 at 19:36
  • @JohnKugelman I couldn't, would have to involve the sys admins for that. That's possible, although I was hoping I could handle the problem myself. Commented Oct 19, 2012 at 19:56

1 Answer 1

2

Instead of trying to change where the code looks for the includes, or changing the makefile to include some other directory, how about changing the contents of /usr/include/boost so that it points to the new stuff?

Here's what I'd try to do:

  1. Rename /usr/include/boost to something else, perhaps /usr/include/boost-old
  2. Create a symbolic link that points /usr/include/boost -> /usr/boost/include/boost-old
  3. You can now test this config by compiling your app. It should inlcude the old Boost libraries.
  4. Install the new Boost libraries to a new directory, say /usr/include/boost-new
  5. Change the suymbolic link to point to the new libraries /usr/include/boost -> /usr/include/boost-new
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.