github twitter email rss
Using C++11 and Boost library in XCode
2012 Jun 1
One minute read

Using C++11 and Boost library in XCode

Install Boost using homebrew

Run brew install boost --universal --c++11

Configure XCode project

http://stackoverflow.com/questions/5288822/using-boost-with-xcode4

Project -> target -> Build Phases   -> Link Binary With Libraries
                                        libboost..
                  -> Build Settings -> Header Search Paths
                                        /usr/local/include/ (non-recursive)
                                    -> Library Search Paths
                                        /usr/local/lib/ (non-recursive)

Use it

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;
    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

(take look at official documentation)[http://www.boost.org/doc/libs/1_52_0/more/getting_started/unix-variants.html]

Installing Boost with MacPorts

Run sudo port install boost
Paths will be /opt/local/include /opt/local/lib


Back to posts


comments powered by Disqus