473,386 Members | 1,712 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,386 software developers and data experts.

Problems using Boost, Pls Advise

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

Hi,

I'm a C++ newbie trying to use the Boost regex libraries. Here's my
situation.

My system is Red Hat Linux 9, using the Borland C++BuilderX Personal IDE
(which uses the g++ compiler).

I downloaded and installed Boost from boost.org using the command:

bjam -sTOOLS=gcc install

The install seemed to complete fine, with 2900+ targets updated.

The libraries install in /usr/local/include/boost-1_31/boost.

I created the following link:

ln -s /usr/local/include/boost-1_31/boost /usr/include/boost

I then use C++BuilderX to try and compile one of the example programs
for the regex libaries that I found in the documentation. The source
code is:

///////////////////////

#include <list>
#include <boost/regex.hpp>
unsigned tokenise(std::list<std::string>& l, std::string& s)
{
return boost::regex_split(std::back_inserter(l), s);
}

#include <iostream>
using namespace std;
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ ==
0x550))
//
// problem with std::getline under MSVC6sp3
istream& getline(istream& is, std::string& s)
{
s.erase();
char c = is.get();
while(c != '\n')
{
s.append(1, c);
c = is.get();
}
return is;
}
#endif
int main(int argc)
{
string s;
list<string> l;
do{
if(argc == 1)
{
cout << "Enter text to split (or \"quit\" to exit): ";
getline(cin, s);
if(s == "quit") break;
}
else
s = "This is a string of tokens";
unsigned result = tokenise(l, s);
cout << result << " tokens found" << endl;
cout << "The remaining text is: \"" << s << "\"" << endl;
while(l.size())
{
s = *(l.begin());
l.pop_front();
cout << s << endl;
}
}while(argc == 1);
return 0;
}
///////////////////////

The compiler returns the following errors:

///////////////////////

g++ -c -o /home/sbobrows/cbproject/pmetest/linux/Debug_Build/splittest.o
-g2 -O0 -MD -I/usr/include -I/usr/include/g++-3 splittest.cpp
g++ -o /home/sbobrows/cbproject/pmetest/linux/Debug_Build/pmetest
linux/Debug_Build/splittest.o
linux/Debug_Build/splittest.o(.text+0x2c9): In function `__tcf_0':
"stl_vector.h": /usr/include/c++/3.2.2/bits/stl_vector.h undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::~reg_expression [in-charge]()' at line 998
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail22g et_default_expressionIcEERKNS_14reg_expressionIT_N S_12regex_traitsIS3_EESaIS
3_EEES3_+0x39):
In function `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> > const&
boost::re_detail::get_default_expression<char>(cha r)':
"perl_matcher_common.hpp":
/usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference
to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::reg_expression[in-charge](char const*, unsigned,
std::allocator<char> const&)' at line 734
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost11regex_split ISt20back_insert_iteratorISt4listISsSaISsEEEcSt11c har_traitsIcESaIcENS_12reg
ex_traitsIcEES8_EEjT_RSbIT0_T1_T2_ERKNS_14reg_expr essionISC_T3_T4_EENS_15regex_constants12_match_fla gsEj+0x12e):
In function `unsigned
boost::regex_split<std::back_insert_iterator<std:: list<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, char, std::char_traits<char>,
std::allocator<char>, boost::regex_traits<char>, std::allocator<char>
(std::back_insert_iterator<std::list<std::basic_s tring<char, std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&,
boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> > const&, boost::regex_constants::_match_flags,
unsigned)':
"perl_matcher_non_recursive.hpp":
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::mark_count() const' at line 1059
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resul tsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15reg ex_constants12_match_flagsE+0x78):
In function
`boost::re_detail::perl_matcher<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char>,
std::allocator<char>::perl_matcher[in-charge](__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
boost::match_results<__gnu_cxx::__normal_iterator< char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > > >&, boost::reg_expression<char,
boost::regex_traits<char>, std::allocator<char> > const&,
boost::regex_constants::_match_flags)':
"perl_matcher_non_recursive.hpp":
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::get_traits() const' at line 869
':
"basic_string.tcc": /usr/include/c++/3.2.2/bits/basic_string.tcc
undefined reference to `boost::reg_expression<char,
boost::regex_traits<char>, std::allocator<char> >::empty() const' at
line 146
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEE24estimate_max_state_count EPSt26random_access_iterator_tag+0x30):
In function
`boost::re_detail::perl_matcher<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char>,
std::allocator<char>::estimate_max_state_count(std::random_access_ite rator_tag*)':

"regex_grep.hpp": /usr/include/boost/regex/v4/regex_grep.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::size() const' at line 46
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEE8find_impEv+0xc0):
In function
`boost::re_detail::perl_matcher<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char>,
std::allocator<char> >::find_imp()':
"regex_grep.hpp": /usr/include/boost/regex/v4/regex_grep.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::mark_count() const' at line 49
Build cancelled due to errors
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEE8find_impEv+0x202):
In function
`boost::re_detail::perl_matcher<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char>,
std::allocator<char> >::find_imp()':
"perl_matcher_non_recursive.hpp":
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::mark_count() const' at line 767
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEE8find_impEv+0x290):
In function `__static_initialization_and_destruction_0':
"perl_matcher_non_recursive.hpp":
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::mark_count() const' at line 1254
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12p erl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEE SaINS_9sub_matchIS6_EEENS_
12regex_traitsIcEESaIcEE8find_impEv+0x2d7):
In function
`boost::re_detail::perl_matcher<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__norma l_iterator<char
const*, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char>,
std::allocator<char> >::find_imp()':
"perl_matcher_common.hpp":
/usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference
to `boost::re_detail::verify_options(unsigned,
boost::regex_constants::_match_flags)' at line 821
linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail8ac cess_tIcNS_12regex_traitsIcEESaIcEE5firstERKNS_14r eg_expressionIcS3_S4_EE+0x
d):
In function `boost::re_detail::access_t<char, boost::regex_traits<char>,
std::allocator<char> >::first(boost::reg_expression<char,
boost::regex_traits<char>, std::allocator<char> > const&)':
"regex_split.hpp": /usr/include/boost/regex/v4/regex_split.hpp undefined
reference to `boost::reg_expression<char, boost::regex_traits<char>,
std::allocator<char> >::first(boost::reg_expression<char,
boost::regex_traits<char>, std::allocator<char> > const&) at line 36
///////////////////////
After searching around extensively, I've not come up with any solution
to my problem. Can someone please point me in the right direction? It
seems like I'm just missing some configuration step along the way.

Thanks in advance, Steve!
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #1
7 3150
sbobrows wrote:

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

[big snip]

You are aware that there is a Boost newsgroup, right?

news://news.gmane.org/gmane.comp.lib.boost.devel

Seems that this would be much more topical there than here.
Jul 22 '05 #2
No, I did not. Sorry, I'll repost this there.

Thanks for your direction!

Steve

"Julie" <ju***@nospam.com> wrote in message
news:40***************@nospam.com...
sbobrows wrote:

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

[big snip]

You are aware that there is a Boost newsgroup, right?

news://news.gmane.org/gmane.comp.lib.boost.devel

Seems that this would be much more topical there than here.

Jul 22 '05 #3
sbobrows wrote:

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

[big snip]

You are aware that there is a Boost newsgroup, right?

news://news.gmane.org/gmane.comp.lib.boost.devel

Seems that this would be much more topical there than here.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #4
sbobrows <sb******@animatedlearning.com> writes:
{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

Hi,

I'm a C++ newbie trying to use the Boost regex libraries. Here's my
situation.

My system is Red Hat Linux 9, using the Borland C++BuilderX Personal IDE
(which uses the g++ compiler).

I downloaded and installed Boost from boost.org using the command:

bjam -sTOOLS=gcc install

The install seemed to complete fine, with 2900+ targets updated.

The libraries install in /usr/local/include/boost-1_31/boost.

I created the following link:

ln -s /usr/local/include/boost-1_31/boost /usr/include/boost

I then use C++BuilderX to try and compile one of the example programs
for the regex libaries that I found in the documentation. The source
code is:

{quoted code snipped by mod. -mod/fwg}
[snip]

I don't know how to answer this without making the answer g++
specific. So those of you without g++, please bear with me.

Most libraries consist of two parts: header files, and binary
libraries containing compiled code. On most unicies, any error
about 'undefined reference to ...' or 'undefined symbol ...'
means the compiled binary libs were not found, or are
inconsistent with the header files.

You need to tell your compiler how to link in the binary library
containing the compiled code for boost::regex.

This will be different for each implementation, but for GCC, you must
tell the compiler two things:

(0) The name of the binary library, using '-l<library name>',
(1) The location of the library, using
'-L<directory containing compiled library>'

So your link command line should look something like this:

g++ linux/Debug_Build/splittest.o -lboost_regex -L/usr/local/lib

Finally see the gcc documentation: http://xrl.us/bx2p .

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #5
In message <40***************@nospam.com>, Julie <ju***@nospam.com>
writes
sbobrows wrote:

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

[big snip]

You are aware that there is a Boost newsgroup, right?

news://news.gmane.org/gmane.comp.lib.boost.devel

Seems that this would be much more topical there than here.


If it's server-specific, is it really a "newsgroup"?

--
Richard Herring
Jul 22 '05 #6
Richard Herring wrote:

In message <40***************@nospam.com>, Julie <ju***@nospam.com>
writes
sbobrows wrote:

{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}

[big snip]

You are aware that there is a Boost newsgroup, right?

news://news.gmane.org/gmane.comp.lib.boost.devel

Seems that this would be much more topical there than here.


If it's server-specific, is it really a "newsgroup"?


Feel free to call it what you wish. I was merely pointing out that there is a
publicly available forum for the discussion of topic-specific items -- I prefer
to call that a newsgroup.
Jul 22 '05 #7
In message <40***************@nospam.com>, Julie <ju***@nospam.com>
writes
Richard Herring wrote:

In message <40***************@nospam.com>, Julie <ju***@nospam.com>
writes
>sbobrows wrote:
> >
> > {Whilst I think much of this is OT for this newsgroup, I think the issue
> > of understanding diagnostics just about gets under the door. -mod}
>[big snip]
>
>You are aware that there is a Boost newsgroup, right?
>
>news://news.gmane.org/gmane.comp.lib.boost.devel
>
>Seems that this would be much more topical there than here.


If it's server-specific, is it really a "newsgroup"?


Feel free to call it what you wish. I was merely pointing out that there is a
publicly available forum for the discussion of topic-specific items -- I prefer
to call that a newsgroup.


For a suitable definition of "publicly", maybe. If I can't ask the
newsmaster to add it to my local server, then I can't access it.

Which is why, if it doesn't follow the flood-filling propagation through
multiple servers characteristic of normal newsgroups, I'd prefer to call
it something else. "BBS accessible via NNTP", perhaps?

--
Richard Herring
Jul 22 '05 #8

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

Similar topics

6
by: Marc | last post by:
T x; T foo(T, T); bind1st(ptr_fun(foo), x) creates a function object that takes an argument of type T const&. This does not work if T is already a reference type like int const&. So my first...
3
by: g | last post by:
hello! here is some code: #ifndef RESOURCE_H_ #define RESOURCE_H_ #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/thread/mutex.hpp>
6
by: Toby Bradshaw | last post by:
Hi, Consider the following: class A { public: virtual bool foo() = 0; };
3
by: Nelis Franken | last post by:
Good day. I'm having trouble telling STL to use a member function to sort items within the relevant class. The isLess() function needs to have access to the private members of the Foo class to...
1
by: =?UTF-8?B?SmVucyBNw7xsbGVy?= | last post by:
(I also posted this to boost-user) The BGL implementation of breadth-first search uses a dedicated color map. I had the following idea: Some algorithms don't need to distinguish black/gray,...
1
by: Olaf Petzold | last post by:
Hi, at this time I try to combine Qt and boost. Unfortunately I've run into trouble: void QWidget::insertAction ( QAction * before, QAction * action ); class QAction : public QWidget { ... };...
13
by: jubelbrus | last post by:
Hi I'm trying to do the following. #include <vector> #include <boost/thread/mutex.hpp> #include <boost/shared_ptr.hpp> #include <boost/tuple/tuple.hpp> class {
10
by: Cliff | last post by:
Greetings, I have been trying to teach myself C++ over the past few weeks and have finally came across a problem I could not fix. I made a simple program that prints out a square or rectangle...
0
by: marcell71 | last post by:
I'm trying to get Boost.Python to working using the instructions here: http://www.boost.org/libs/python/doc/building.html. I am on step 3.1.4 and am getting a linking error that I can't figure out....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.