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

Project -> target -> Build Phases   -> Link Binary With Libraries
                  -> 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;
        in(std::cin), in(), std::cout << (_1 * 3) << " " );

(take look at official documentation)[]

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