| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Andreas S." |
| Date: |
03 Sep 2006 11:09:17 AM |
| Object: |
Not able to link against boost library |
Hi,
I don't any solution any more... I have written a small tool wich uses
the boost library. It compiles fine, but I can't link it.
I am on a Fedora Core 6 x86_64 system. The boost library is installed
with "yum install boost" - so this should be fine.
ldconfig | grep boost gives me a list with all the installed boost
libraries, including the two (libboost_filesystem.so and
libboost_regex.so) I need.
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesystem", which should include the boost libraries for the
linker, as far as I know.
but when i call g++ to link my two object files to the binary, it fails:
g++ -o hrmmerge HRMmerge.o fileinfo.o -L/usr/lib64
HRMmerge.o: In function `open_files(char*)':
HRMmerge.cpp:(.text+0x1f9): undefined reference to
`boost::filesystem::path::path(char const*)'
HRMmerge.cpp:(.text+0x202): undefined reference to
`boost::filesystem::exists(boost::filesystem::path const&)'
HRMmerge.cpp:(.text+0x254): undefined reference to
`boost::filesystem::path::path(char const*)'
HRMmerge.cpp:(.text+0x29e): undefined reference to
`boost::filesystem::path::leaf() const'
HRMmerge.cpp:(.text+0x2c2): undefined reference to
`boost::filesystem::is_directory(boost::filesystem::path const&)'
HRMmerge.o: In function
`boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path
const&)':
HRMmerge.cpp:(.text._ZN5boost10filesystem18directory_iteratorC1ERKNS0_4pathE[boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path
const&)]+0x2c): undefined reference to
`boost::filesystem::detail::dir_itr_init(boost::shared_ptr<boost::filesystem::detail::dir_itr_imp>&,
boost::filesystem::path const&)'
HRMmerge.o: In function `boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char
const*, char const*, unsigned int)':
HRMmerge.cpp:(.text._ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char
const*, char const*, unsigned int)]+0x27): undefined reference to
`boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*,
unsigned int)'
and so on...
Anybody an idea what to do? My c++ experience is not really fresh
anymore and I am not too familiar with g++ and building software on
linux. So I am stuck :-(
Thanks in advance!
Andreas
.
|
|
| User: "Rolf Magnus" |
|
| Title: Re: Not able to link against boost library |
03 Sep 2006 02:25:50 PM |
|
|
Andreas S. wrote:
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesystem",
libstdc++ is automatically linked, so you should drop it. Are you sure you
need newlib? It is meant for relatively small embedded systems, which you
don't seem to be writing your code for. Then change
'-libboost_regex -libboost_filesystem'
into '-boost_regex -lboost_filesystem'
which should include the boost libraries for the
linker, as far as I know.
but when i call g++ to link my two object files to the binary, it fails:
g++ -o hrmmerge HRMmerge.o fileinfo.o -L/usr/lib64
Uhm, where are your LDFLAGS?
Anybody an idea what to do? My c++ experience is not really fresh
anymore and I am not too familiar with g++ and building software on
linux. So I am stuck :-(
As a matter of fact, you are quite off-topic here, because this newsgroup is
only about the C++ language itself, not any build tools/compilers/linkers.
I suggest something like comp.unix.programmer .
.
|
|
|
|
| User: "Daniel Kay" |
|
| Title: Re: Not able to link against boost library |
03 Sep 2006 11:29:47 AM |
|
|
Andreas S. wrote:
[...]
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesystem", which should include the boost libraries for the
linker, as far as I know.
Try to replace -libboost_regex against -lboost_regex and
-libboost_filesystem against -lboost_filesystem in your linker call.
[...]
CU,
Daniel Kay
.
|
|
|
| User: "Andreas S." |
|
| Title: [Solved] Re: Not able to link against boost library |
03 Sep 2006 02:37:17 PM |
|
|
Daniel Kay wrote:
Andreas S. wrote:
[...]
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesystem", which should include the boost libraries for
the linker, as far as I know.
Try to replace -libboost_regex against -lboost_regex and
-libboost_filesystem against -lboost_filesystem in your linker call.
[...]
CU,
Daniel Kay
Thanks! This and changing the order of the files to link solved the
problem. :-)
Greets,
Andreas
.
|
|
|
|
|

|
Related Articles |
|
|