boost compiling problem [message #753942] |
Mon, 31 October 2011 00:07  |
Eclipse User |
|
|
|
Hello, I tried to use boost in Eclipse on Windows. My testing program:
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
return 0;
}
Thanks for help.
The build error message:
-------------------------
**** Rebuild of configuration Debug for project hello ****
**** Internal Builder is used for build ****
g++ -IC:\boost_1_47_0 -O0 -g3 -Wall -c -fmessage-length=0 -o src\hello.o ..\src\hello.cpp
g++ -o hello.exe src\hello.o
src\hello.o: In function `_static_initialization_and_destruction_0':
C:/boost_1_47_0/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
C:/boost_1_47_0/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
C:/boost_1_47_0/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
src\hello.o: In function `ZN5boost11filesystem311path_traits7convertEPKcRSbIwSt11char_traitsIwESaIwEERKSt7codecvtIwciE':
C:/boost_1_47_0/boost/filesystem/v3/path_traits.hpp:113: undefined reference to `boost::filesystem3::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&)'
src\hello.o: In function `ZN5boost11filesystem34path7codecvtEv':
C:/boost_1_47_0/boost/filesystem/v3/path.hpp:388: undefined reference to `boost::filesystem3::path::wchar_t_codecvt_facet()'
src\hello.o: In function `ZN5boost11filesystem39file_sizeERKNS0_4pathE':
C:/boost_1_47_0/boost/filesystem/v3/operations.hpp:366: undefined reference to `boost::filesystem3::detail::file_size(boost::filesystem3::path const&, boost::system::error_code*)'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1422 ms.
|
|
|
|
|
Re: boost compiling problem [message #754126 is a reply to message #754070] |
Mon, 31 October 2011 19:09  |
Eclipse User |
|
|
|
I am able to build the binaries now. They are placed under C:\boost_1_47_0\stage\lib. To test the filesystem library. I added "boost_filesystem-mgw46-mt-1_47" to the MinGW C++ linker's 'libraries', but I still get an undefined reference problem:
There are two libraries built for filesystem under stage/lib:
libboost_filesystem-mgw46-mt-1_47.a
libboost_filesystem-mgw46-mt-d-1_47.a
Anything wrong here?
--------------------------------------------------------------
**** Rebuild of configuration Debug for project Hello ****
**** Internal Builder is used for build ****
g++ -IC:\boost_1_47_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\hello.o ..\src\hello.cpp
g++ -LC:\boost_1_47_0\stage\lib -oHello.exe src\hello.o -lboost_filesystem-mgw46-mt-1_47
src\hello.o: In function `_static_initialization_and_destruction_0':
C:/boost_1_47_0/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
C:/boost_1_47_0/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
C:/boost_1_47_0/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x65): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0xb3): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3b4): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x427): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x52c): more undefined references to `boost::system::system_category()' follow
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3755): undefined reference to `boost::system::generic_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x377c): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3795): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x37d9): undefined reference to `boost::system::generic_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x38c2): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x39ed): undefined reference to `boost::system::generic_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3a13): undefined reference to `boost::system::generic_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3b08): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3b30): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3b72): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3d22): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x3e5d): undefined reference to `boost::system::system_category()'
C:\boost_1_47_0\stage\lib/libboost_filesystem-mgw46-mt-1_47.a(operations.o):operations.cpp:(.text+0x4ad2): more undefined references to `boost::system::system_category()' follow
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1112 ms.
|
|
|
Powered by
FUDForum. Page generated in 0.03446 seconds