Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » boost compiling problem
boost compiling problem [message #753942] Mon, 31 October 2011 04:07 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 28
Registered: November 2010
Junior Member
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 #754070 is a reply to message #753942] Mon, 31 October 2011 16:10 Go to previous messageGo to next message
Edward  is currently offline Edward Friend
Messages: 2
Registered: October 2011
Junior Member
boost Filesystem needs to be built before you can use the library.

If you have done so, please put the following libraries in your list of libraries to link against:
boost system and boost filesystem (I can't remember the exact names for windows).
Re: boost compiling problem [message #754116 is a reply to message #754070] Mon, 31 October 2011 21:39 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 28
Registered: November 2010
Junior Member
Yes, I tried to build boost binaries on my windows machine for eclipse, but hasn't been successful.


I think I first need to build the bjam tool. but I didn't find the jam/ directory under boost/tools/ directory.

Any ideas on how to build boost for eclipse on Windows machine?

Thanks.
Re: boost compiling problem [message #754126 is a reply to message #754070] Mon, 31 October 2011 23:09 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 28
Registered: November 2010
Junior Member
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.
Previous Topic:PathEntry Marker jobs never finishes, blocks many other jobs
Next Topic:Debug Problem With CDT
Goto Forum:
  


Current Time: Tue Apr 23 08:17:59 GMT 2024

Powered by FUDForum. Page generated in 0.03780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top