0

First, I've tried http://www.boost.org/doc/libs/1_39_0/more/getting_started/unix-variants.html and Build Boost on Mac with Xcode and Using Boost with Xcode4 in painful detail, to no avail. I've spent about 5 hours on this thus far and have had no luck.

In painful detail, how do I install boost with my XCode C++ project.

What I've tried thus far:

Option 1. XCode -> File -> Add files to "Project Name"

Option 2. Building XCode as per http://www.boost.org/doc/libs/1_39_0/more/getting_started/unix-variants.html. The build works fine, but I cannot get XCode to recognize it.

Option 3. XCode -> Project -> Build Settings -> User Header Search Paths -> Add Build Setting... and adding in the path to the .hpp files

Option 4. XCode -> Targets -> Build Phases -> Link Binary With Libraries -> Add in all the compiled libraries

An interesting observation. The following is recognized by XCode:

#include "boost/asio.hpp"

The following is not recognized by XCode:

#include <boost/asio.hpp>

enter image description here

Please don't send me the same old links from the other articles. I have spent hours reading them.

Community
  • 1
  • 1
eb80
  • 4,700
  • 5
  • 25
  • 30
  • What exactly are you trying to do? Are you building the Boost libraries, or are you trying to build your own project, which should be linked against one or more of the Boost libraries? – jalf Apr 07 '13 at 20:01
  • I have my own code and I am trying to use the libraries in my own code (hence including them). – eb80 Apr 07 '13 at 20:19
  • Did you have any luck with one of the suggested answers? If you did please tell us. I have a similar issue. – Stefan Vasiljevic Jan 28 '14 at 06:09

2 Answers2

1

Because the header file is recognised as #include "boost/asio.hpp" but not as #include <boost/asio.hpp>, you might have done the wrong setup in the Xcode code project.

There are two sections in Xcode where you can add a directory to the include path:

  • "Header Search Paths"
  • "User Header Search Paths"

You should use "Header Search Paths" for boost.

jcm
  • 947
  • 7
  • 16
0

If you added the actual path to the .hpp files to your include path, then that is your problem.

You're not including asio.hpp, you're including boost/asio.hpp. So the include path should not be the directory that contains asio.hpp, but the directory that contains the boost subdirectory.

jalf
  • 243,077
  • 51
  • 345
  • 550