简体   繁体   中英

Checking Boost install with MinGW

I used the MinGW installation at http://nuwen.net/mingw.html

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)

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

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).

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 ). Correct command will be g++ -o second second.cpp -lboost_system -lboost_filesystem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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