473,769 Members | 6,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_files ystem.so and
libboost_regex. so) I need.

The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesy stem", 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(cha r*)':
HRMmerge.cpp:(. text+0x1f9): undefined reference to
`boost::filesys tem::path::path (char const*)'
HRMmerge.cpp:(. text+0x202): undefined reference to
`boost::filesys tem::exists(boo st::filesystem: :path const&)'
HRMmerge.cpp:(. text+0x254): undefined reference to
`boost::filesys tem::path::path (char const*)'
HRMmerge.cpp:(. text+0x29e): undefined reference to
`boost::filesys tem::path::leaf () const'
HRMmerge.cpp:(. text+0x2c2): undefined reference to
`boost::filesys tem::is_directo ry(boost::files ystem::path const&)'
HRMmerge.o: In function
`boost::filesys tem::directory_ iterator::direc tory_iterator(b oost::filesyste m::path
const&)':
HRMmerge.cpp:(. text._ZN5boost1 0filesystem18di rectory_iterato rC1ERKNS0_4path E[boost::filesyst em::directory_i terator::direct ory_iterator(bo ost::filesystem ::path
const&)]+0x2c): undefined reference to
`boost::filesys tem::detail::di r_itr_init(boos t::shared_ptr<b oost::filesyste m::detail::dir_ itr_imp>&,
boost::filesyst em::path const&)'
HRMmerge.o: In function `boost::basic_r egex<char,
boost::regex_tr aits<char, boost::cpp_rege x_traits<char >::assign(cha r
const*, char const*, unsigned int)':
HRMmerge.cpp:(. text._ZN5boost1 1basic_regexIcN S_12regex_trait sIcNS_16cpp_reg ex_traitsIcEEEE E6assignEPKcS7_ j[boost::basic_re gex<char,
boost::regex_tr aits<char, boost::cpp_rege x_traits<char >::assign(cha r
const*, char const*, unsigned int)]+0x27): undefined reference to
`boost::basic_r egex<char, boost::regex_tr aits<char,
boost::cpp_rege x_traits<char >::do_assign(ch ar 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 13015
Andreas S. wrote:

[...]
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesy stem", which should include the boost libraries for the
linker, as far as I know.
Try to replace -libboost_regex against -lboost_regex and
-libboost_filesy stem against -lboost_filesyst em in your linker call.

[...]

CU,
Daniel Kay
Sep 3 '06 #2
Andreas S. wrote:
The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesy stem",
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_filesy stem'
into '-boost_regex -lboost_filesyst em'
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.progr ammer .
Sep 3 '06 #3
Daniel Kay wrote:
Andreas S. wrote:

[...]
>The LDFLAG is set to "-lstdc++ -newlib -libboost_regex
-libboost_filesy stem", which should include the boost libraries for
the linker, as far as I know.

Try to replace -libboost_regex against -lboost_regex and
-libboost_filesy stem against -lboost_filesyst em 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
10700
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
1836
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 stl, and everything works fine. I wanted to try to link the same code against the stlport. but I get a lot of linking errors (i report one of those at the end of the message) and I don't understand why... could it be because the EnRG lib is...
16
2615
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 years now. The first two postings in this group this morning are addressed almost trivially by using libraries from www.boost.org. IMO, the functionality in boost increases the usability of C++ at least as much as the standard library does. ...
1
7791
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~ make.exe -f "D:\temp\Makefile.win" all g++.exe -c main.cpp -o
14
2837
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 number) linking (and sometimes compiling) becomes immensely slow, and task manager shows that link.exe (or cl.exe) is barely using any processor time, but an awful lot of RAM (around 150-200MB). I'm going to keep an eye on page faults since I can't...
6
1763
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 with prior beta releases of boost-1.33.1 or with the VC8.0 beta. You may want to consider whether the crash of a dependent tool should be allowed to cause the entire VC8 IDE to hang or whether this might be a design defect. Given the recent price...
0
2515
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 of you might have an answer. I would greatly appreciate help with this, as I tried to search for an answer for quite some time in vain. I am getting error messages when I try to compile as soon as I put an include to the boost library in the...
34
3181
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
2414
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
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.