473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 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 12973
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++
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.