亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

boost庫鏈接出錯怎么辦

發布時間:2021-05-18 15:21:19 來源:億速云 閱讀:202 作者:小新 欄目:編程語言

這篇文章將為大家詳細講解有關boost庫鏈接出錯怎么辦,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

安裝完最新的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  

否則會報錯:

error while 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庫鏈接出錯怎么辦”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

肇州县| 东乌珠穆沁旗| 乐业县| 古浪县| 万载县| 汽车| 建瓯市| 定边县| 屯留县| 云浮市| 陆川县| 永仁县| 恭城| 墨玉县| 和静县| 墨竹工卡县| 黄浦区| 长海县| 巨鹿县| 德昌县| 汶上县| 江源县| 河北省| 昭觉县| 义乌市| 宜兰县| 商丘市| 隆尧县| 万山特区| 新密市| 得荣县| 广灵县| 彭泽县| 斗六市| 古交市| 泰和县| 孝感市| 太白县| 梁平县| 璧山县| 红安县|