3

I am trying to include boost library to xcode, and xcode is complaining about include.

I am a mac user, and the library is under

/usr/local/boost_1_62_0

Under Build Setting, I added the path for Header Search Paths and User Header Search Paths.

In .cpp, I tried to use

#include <boost/asio.hpp>

but it threw an error saying fix the to "quote". Once I did that, it's complaing about the libary files themselves have to fix to "quote", as attached picture shows.

Any suggestions??

error message

2
  • What specific paths did you set? Is the file asio.hpp in /usr/local/boost_1_62_0/boost/asio.hpp or somewhere else, such as /usr/local/boost_1_62_0/include/boost/asio.hpp? Commented Nov 6, 2016 at 13:08
  • The file is at /usr/local/boost_1_62_0/include/boost/asio.hpp. I added /usr/local/boost_1_62_0/include to Header Search Paths and User Header Search Paths. Commented Nov 6, 2016 at 23:23

1 Answer 1

0

Add /usr/local/boost_1_62_0 to System Header Search Paths instead of User Header Search Paths. Then you can write #include <boost/asio.hpp> without any problems.

Explanation:

#include <filename> is for including system library headers while #include "filename" is for user-defined headers.

All of the instances of #include <boost/filename.hpp> in the Boost header files expect boost/filename.hpp to be in the system header search path, which isn't the case when you just set User Header Search Paths to /usr/local/boost_1_62_0.

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.