日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

undefined reference to `boost::system::generic_category()

發(fā)布時間:2024/2/28 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 undefined reference to `boost::system::generic_category() 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

報錯大致如下:

main.cpp:(.text+0x49): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x53): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x5d): undefined reference to `boost::system::system_category()'

當時搞了很久,各種庫各種一通鏈接,始終沒解決問題

解決方案:

"boost/filesystem.hpp" 這個文件依賴于boost_system,編譯的時候,需要 -lboost_system選項,但是你的編譯選項里頭已經(jīng)指定該選項,為什么還會出現(xiàn)鏈接錯誤呢。我也納悶了半天,后來發(fā)現(xiàn),原來是-l選項的順序問題。在g++的man幫助信息里面,我發(fā)現(xiàn)了下面的話:

引用 It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus,?foo.o -lz bar.o?searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded. 讀完這段話,應該就明白出錯原因了。所以,解決方案就是用下面的命令來編譯:
引用g++ main.cpp -lboost_system -lboost_filesystem

總結

以上是生活随笔為你收集整理的undefined reference to `boost::system::generic_category()的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。