在mac下使用boost C++

http://www.boost.org/doc/libs/1_48_0/more/getting_started/unix-variants.html

 Easy Build and Install

Issue the following commands in the shell (don't type $; that represents the shell's prompt):

$ cd path/to/boost_1_48_0
$ ./bootstrap.sh --help
$ ./bootstrap.sh --prefix=PREFIX

to install somewhere else. Also, consider using the --show-libraries and --with-libraries=library-name-list options to limit the long wait you'll experience if you build everything. Finally,

$ ./b2 install

编译好的文件在boost_1_48_0/PREFIX/lib下

 

新建一个Cocoa Application 应用程序

将AppDelegate.m改为.mm

选择build settings

Header Search Paths 添加引用路径到   (boost_1_48_0文件路径)/boost_1_48_0/PREFIX/include

选择Build phases 添加link binary with libraries 从刚才的编译路径boost_1_48_0/PREFIX/LIB下的所有文件。

AppDelegate.mm

#include <boost/regex.hpp>

编译成功

 

posted @ 2011-12-13 12:33  曙光中睡懒觉  阅读(724)  评论(0)    收藏  举报