Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include boost in xcode

Tags:

xcode

boost

I could not include boost in xcode. I used the build instructions from the Boost documentation and wrote the search paths in xcode /usr/local/lib and /usr/local/include.

Any help please !

like image 582
Heba Avatar asked Apr 13 '12 13:04

Heba


2 Answers

I have spent a long time trying to make this work. I could not make it work using the download from the Boost project homepage, so I used homebrew instead:

After homebrew is installed, I installed Boost using:

brew install boost 

or, if you don't have python installed, using:

brew install boost --without-python

Without the --without-python it would not install on my machine.

  1. In XCode (4.3.3), select the project file in the left sidebar (top most), and select it again in the project pane.
  2. Select the Build Settings tab, and select All.
  3. Under Search Paths, add the header search path /usr/local/Cellar/boost/1.49.0/include/ and check the box. The path should now show in the Build Settings.

Now, you can use:

#include <boost/regex.hpp>

or whatever you need from the Boost package.


In case you have boost already installed, use $ brew info boost to get the correct path:

boost: stable 1.60.0 (bottled), HEAD
Collection of portable C++ source libraries
https://www.boost.org/
/usr/local/Cellar/boost/1.60.0_1 (11,139 files, 436.5M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/boost.rb
like image 55
henrikstroem Avatar answered Nov 15 '22 13:11

henrikstroem


I'm using boost with Xcode 3.2.1 on mac os 10.6.8

I had problems with using boost and Xcode today, finally I managed to make it work so I hope this helps:

  1. download boost, I got the 1.52.0 today, untar it

  2. install boost:

    at first I couldn't do the ./bootstrap.sh, it stopped after the first few lines. After some googling, I got the answer, it was because when I installed Xcode a long time ago, for some reason I didn't check the “Unix development" in the install options. At this point, reinstall a newer version of Xcode and check the "unix development line"

    after that, the ./bootstrap and ./b2 install worked fine

  3. the lambda example:

    at this point, the first example should work fine, if it doesn't try adding /usr/local/include in the project settings/header search path

  4. using thread or something else that requires to be built

    threads require a specific dylib to work: libboost_system.dylib. on my system it was located in /usr/local/lib after the ./b2 install thingy

    in the left part of the GUI, you can right click anywhere and select Add Existing File

    if the file is hidden you can find a shortcut to get to usr/local/lib in the directory /Developer/SDKs/MacOSX10.6.sdk/usr/local

once the libboost_system.dylib does appear in the Groups and Files part of the GUI, it should work

like image 23
instazz Avatar answered Nov 15 '22 15:11

instazz