472,958 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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._ZN5boost10filesystem18directo ry_iteratorC1ERKNS0_4pathE[boost::filesystem::directory_iterator::directory_i terator(boost::filesystem::path
const&)]+0x2c): undefined reference to
`boost::filesystem::detail::dir_itr_init(boost::sh ared_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_12r egex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEP KcS7_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
Sep 3 '06 #1
3 12950
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
Sep 3 '06 #2
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 .
Sep 3 '06 #3
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
Sep 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
2
by: Ricky Corsi | last post by:
hello everybody, I have an application that uses a 3D engine library compiled as a static library called EnRG.lib. My own code is normally compiled against the MS Visual C implementation of the...
16
by: Jeff Flinn | last post by:
At the risk of raising the OT ire of some here, I'd like to know what might be done to raise the awareness of the boost libraries. I've found boost and it's libraries invaluable in my work for ~5...
1
by: Hardy | last post by:
Hi, just come into the boost world. just the first.cpp in the program_options examples, with many link error... devc++4.9.9.2, gcc 3.4.2, can I get your opinions on this problem? thank you~ ...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
6
by: George M. Garner Jr. | last post by:
VC8.0 crashes while compiling boost-1.33.1 serialization library (or any other library that includes the serialization headers) if code analysis (/analyze) is enabled. This problem did not occur...
0
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some...
34
by: Guch Wu | last post by:
Boost has many terrific libraries. But I want to know whether they are ready for using in real projects. Which of them are mature enough, or just only in progress?
2
by: g.vukoman | last post by:
Hi all! I have a problem with my Makefile/library. My library "libmylib.so" includes the header file <boost/regex.hpp>. My Makefile uses following variables: CC = gcc CXX = g++
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.