简体   繁体   English

使用MinGW检查Boost安装

[英]Checking Boost install with MinGW

I used the MinGW installation at http://nuwen.net/mingw.html 我在http://nuwen.net/mingw.html上使用了MinGW安装

I ran the second.cpp test found at: http://tabreziqbal.wordpress.com/2006/03/16/how-to-test-c-boost-installation/ (I used the correct commands to run from the comments, which was g++ -o second second.cpp -lboost_filesystem) 我运行了位于以下位置的second.cpp测试: http : //tabreziqbal.wordpress.com/2006/03/16/how-to-test-c-boost-installation/ (我使用正确的命令从注释中运行,这是g ++ -o second second.cpp -lboost_filesystem)

I get the following error: 我收到以下错误:

C:\\Users\\user\\Projects\\Programming\\C++\\boostTest2>g++ -o second second.cpp -lboost_filesystem C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x102): undefined reference to boost::system::generic_cat egory()' C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x10c): undefined reference to boost::system::generic_cat egory()' C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x116): undefined reference to boost::system::system_cate gory()' C:\\MinGW\\bin/ld.exe: C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o: bad reloc address 0xe in section .text$_ZN5boost6syst em14error_categoryD1Ev[__ZN5boost6system14error_categoryD1Ev]' C:\\MinGW\\bin/ld.exe: final link failed: Invalid operation collect2.exe: error: ld returned 1 exit status C:\\ Users \\ user \\ Projects \\ Programming \\ C ++ \\ boostTest2> g ++ -o second.cpp -lboost_filesystem C:\\ Users \\ user \\ AppData \\ Local \\ Temp \\ ccDlbKGy.o:second.cpp :(。text + 0x102 ):对boost::system::generic_cat egory()' C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x10c): undefined reference to未定义引用boost::system::generic_cat egory()' C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x10c): undefined reference to boost boost::system::generic_cat egory()' C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o:second.cpp:(.text+0x10c): undefined reference to :: system :: generic_cat egory()'C:\\ Users \\ user \\ AppData \\ Local \\ Temp \\ ccDlbKGy.o:second.cpp :(。text + 0x116):对boost::system::system_cate gory()' C:\\MinGW\\bin/ld.exe: C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o: bad reloc address 0xe in section gory()的未定义引用boost::system::system_cate gory()' C:\\MinGW\\bin/ld.exe: C:\\Users\\user\\AppData\\Local\\Temp\\ccDlbKGy.o: bad reloc address 0xe in section .text $ _ZN5boost6syst em14error_categoryD1Ev [__ ZN5boost6system14error_categoryD1Ev]'C:\\ MinGW \\ bin ld.exe:最终链接失败:无效的操作collect2.exe:错误:ld返回1退出状态

I know there's an installation test feature of boost that I found on http://gcc.gnu.org/testing/testing-boost.html but those files aren't included with the distribution from nuwen.net (so I'd have to do it myself). 我知道我在http://gcc.gnu.org/testing/testing-boost.html上找到了boost的安装测试功能,但是nuwen.net的发行版中不包含这些文件(所以我有自己做)。

And help is appreciated - I figure I'm just screwing up something minor (I hope anyway). 感谢帮助-我认为我只是在搞些小事情(无论如何我还是希望)。

Thanks all! 谢谢大家!

It's not correct command, you should link boost::system too (errors are undefined references to boost::system::system_category ). 这是不正确的命令,您也应该链接boost::system (错误是boost::system::system_category未定义引用)。 Correct command will be g++ -o second second.cpp -lboost_system -lboost_filesystem 正确的命令将是g++ -o second second.cpp -lboost_system -lboost_filesystem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM