boost安装

在boost根目录寻找boosttrap.sh并执行    如果不能执行就修改属性chmod a+x ./boosttrap.sh
sudo ./bjam "-sTOOLS=gcc" "--includedir=/usr/include" "--libdir=/usr/lib/boost" install
sudo ./bjam --toolset=gcc --includedir=/usr/local/include --libdir=/usr/local/lib/boost install
装完之后要到boost根目录下的/libs/regex/build      
先chmod a=x ./gcc_gen.sh 再执行,然后make -f ./gcc.mak make -f ./gcc-share.mak

修改环境变量LD_LIBRARY_PATH
(1)在/etc/profile修改,对所有用户,永久
(2)在用户目录下的.bashrc如果没有就.bash_profile下修改,对该用户,永久
(3)直接在虚拟终端export,对当前终端有效
添加的目录要为刚在你自己设置的boost,lib目录,如我自己的/usr/lib/boost,举个例子,在.bashrc中
添加export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/boost保存,然后可以开始编译了

gcc -Wall cppT.cpp -o cppT /usr/local/lib/libboost_regex.so   //动态
gcc -Wall cppT.cpp -o cppT -L/usr/lib -lboost_regex      //静态

posted @ 2012-05-30 17:49  ghost&240  阅读(288)  评论(0编辑  收藏  举报