时间:2021-05-19
安装完最新的Boost库
官方说明中有一句话:
Finally,
$ ./b2 install
will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory.
大部分Boost库无需动态或静态编译链接,小部分如regex thread coroutine之类的库在编译自己的源代码时需要加入链接提示
比如在编译使用regex的库时命令如下:
c++ -I /usr/local/include/boost/ main.cpp -o test1 -L /usr/local/lib -lboost_regex
完成后运行时:
LD_LIBRARY_PATH="/usr/local/lib" ./test1
否则会报错:
errorwhile loading shared libraries: libboost_regex.so.1.64.0: cannot open shared object file: No such file or directory
这个错误在stackoverflow上给的解释是:
The library cannot be found.
Libraries are by default looked for in /lib, /usr/lib and the directories specified by /etc/ld.so.conf.
Usually system libraries (like boost, if you installed it via your package manager) are located in /usr/lib, but it's probably not your case.
Where are your boost libraries located on your system? Did you compile them by yourself? In this case you should tell the dynamic linker to look for your libraries in the directory they're located by using the LD_LIBRARY_PATH environment variable:
LD_LIBRARY_PATH="your/boost/directory" ./testfgci
I'd suggest you to install boost libraries using your package manager, anyway, this will make your life a lot simpler.
也就是说系统在运行程序时要先加载动态库,系统的搜寻目录在/etc/ld.so.conf或者/etc/ld.so.conf.d/*.conf中,而该目录中没有链接库所在的位置,要在该文件中手动加入目录地址或者在运行程序之前指定LD_LIBRARY_PATH的值
这样才能正确识别动态库
以上这篇快速解决boost库链接出错的问题(分享)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
分享VS2010boost标准库开发环境安装教程1.BOOST编译过程非常复杂,目前为了学习BOOST,首先搭建基于VS2010的BOOST开发环境。Boost
Windows安装boost库下载链接:https:///1,下载解压,我的目录“C:\ProgramFiles(x86)\MicrosoftVisualStu
前言最近在卸载PostgreSQL数据库的出错了,无奈只能一步步的进行排查分析解决,下面将解决的过程分享出来,给同样遇到这个问题的朋友们参考学习,下面话不多说了
最近习使用Boost库,发现Boost库对unicode字符集的支持好像采用和STL类似的方式(当然没有完全证实)。STL是什么方式呢?就是在原有的ANSI类型
一、前言好好研究下大名鼎鼎的Boost库。二、Boost安装2.1Boost官网下载Boost最新版Version1.55.02.2将下载压缩包解压到本地解压后