eb80
eb80

Reputation: 4738

Building Boost C++ Library with XCode 4 (Manual Not Working)

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.

Upvotes: 0

Views: 1935

Answers (2)

jcm
jcm

Reputation: 977

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.

Upvotes: 1

Stack Overflow is garbage
Stack Overflow is garbage

Reputation: 247909

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.

Upvotes: 0

Related Questions