我在 eclipse cdt windows 的 boost 中包含以下库。
- libboost_filesystem-vc100-mt-1_51
- libboost_system-vc100-mt-1_51
从律师输出的顶部(下面)他们似乎连接得很好。但是我收到以下错误。
顾问输出/错误:
18:10:00 **** Incremental Build of configuration Debug for project Boost ****
Info: Internal Builder is used for build
g++ "-LC:\\Users\\Mike\\Desktop\\Lib\\boost_1_51_0\\stage\\lib" -o Boost.exe "src\\Boost.o" -llibboost_filesystem-vc100-mt-1_51 -llibboost_system-vc100-mt-1_51
src\Boost.o: In function `_static_initialization_and_destruction_0':
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
src\Boost.o: In function `ZN5boost10filesystem9file_sizeERKNS0_4pathE':
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/filesystem/operations.hpp:447: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
src\Boost.o: In function `path<char [9]>':
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/filesystem/path.hpp:139: undefined reference to `boost::filesystem::path::codecvt()'
src\Boost.o: In function `ZN5boost10filesystem11path_traits8dispatchISbIwSt11char_traitsIwESaIwEEEEvRKSsRT_RKSt7codecvtIwciE':
C:/Users/Mike/Desktop/Lib/boost_1_51_0/boost/filesystem/path_traits.hpp:174: undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
collect2: ld returned 1 exit status
由此看来,系统库没有正确连接/链接。
我的代码:
#include <boost/filesystem.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::filesystem;
file_size("test.txt");
return 0;
}
我错过了什么吗?我需要包含其他内容吗?