最近把cpp代码从开发机放到编译机去,遇到了不少路径问题。
安装boost的时候,其实很简单
wget
tar -xzvf boost_1_54_0.tar.gz
cd boost_1_54_0
./bootstrap.sh --prefix=/usr/local
./b2 install --with=all
boost库被安装在/usr/local/lib下面
编译时
g++ syslogem.cpp -lboost_system
出现
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::system_category()'
只好添加路径
g++ syslogem.cpp -L/usr/local/lib -lboost_system
运行的时候
LD_LIBRARY_PATH=/usr/local/lib
./a.out
出现
error while loading shared libraries: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory
只好手动链接
ln -s /usr/local/lib/libboost_system.so.1.54.0 /lib64
阅读(18543) | 评论(0) | 转发(0) |