1
我已經建立了升壓1.59 MinGW的4.9.2 32位如下:錯誤鏈接,以提高系統
bootstrap.bat mingw
b2 --prefix=%USERPROFILE%\Code\Libraries\boost toolset=gcc install
(這些都是靜態庫)
當試圖編譯:
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace std;
int main()
{
boost::asio::io_service io;
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
cout << "Hello World!" << endl;
return 0;
}
With:
g++ -o test -L %USERPROFILE%\Code\Libraries\boost\lib -l boost_system-mgw49-mt-1_59 -I %USERPROFILE%\Code\Libraries\boost\include\boost-1_59 main.cpp
我得到這個錯誤:
C:\Users\Brady\AppData\Local\Temp\ccsbGjrk.o:main.cpp:(.text+0x193): undefined reference to `boost::system::generic_category()'
C:\Users\Brady\AppData\Local\Temp\ccsbGjrk.o:main.cpp:(.text+0x19d): undefined reference to `boost::system::generic_category()'
C:\Users\Brady\AppData\Local\Temp\ccsbGjrk.o:main.cpp:(.text+0x1a7): undefined reference to `boost::system::system_category()'
C:/Program Files (x86)/QT/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: C:\Users\Brady\AppData\Local\Temp\ccsbGjrk.o: bad reloc address 0xe in section `.text$_ZN5boost6system14error_categoryD2Ev[__ZN5boost6system14error_categoryD2Ev]'
collect2.exe: error: ld returned 1 exit status
我在2臺計算機收到此相同的錯誤。任何幫助表示讚賞!
'C:/ Program Files文件(86)/ QT /工具/ mingw492_32/bin中/../ lib中/ GCC/i686的-W64-的mingw32/4.9.2 /../ ../../../i686-w64-mingw32/bin/ld.exe:找不到-lboost_system collect2.exe:錯誤:ld返回1退出狀態'這就是我使用'-l boost_system-mgw49- mt-1_59' –
您需要啓用詳細模式以查看連接器正在查找文件的情況。如果你設置了-Wl,鏈接器會給出詳細的輸出結果 - 詳細 – user1
我假設'%USERPROFILE%\ Code \ Libraries \ boost \ lib'應該在'LIBRARY_PATH'中?這不是我的情況。 –