Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Problems using Boost, Pls Advise

Reply
Thread Tools

Problems using Boost, Pls Advise

 
 
sbobrows
Guest
Posts: n/a
 
      04-27-2004
{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+0x7:
In function
`boost::re_detail:erl_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>
>:erl_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:erl_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:erl_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:erl_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:erl_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! ]
 
Reply With Quote
 
 
 
 
Julie
Guest
Posts: n/a
 
      04-27-2004
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.
 
Reply With Quote
 
 
 
 
Steve Bobrowski
Guest
Posts: n/a
 
      04-27-2004
No, I did not. Sorry, I'll repost this there.

Thanks for your direction!

Steve

"Julie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Julie
Guest
Posts: n/a
 
      04-28-2004
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! ]
 
Reply With Quote
 
llewelly
Guest
Posts: n/a
 
      04-28-2004
sbobrows <(E-Mail Removed)> 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! ]
 
Reply With Quote
 
Richard Herring
Guest
Posts: n/a
 
      04-28-2004
In message <(E-Mail Removed)>, Julie <(E-Mail Removed)>
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
 
Reply With Quote
 
Julie
Guest
Posts: n/a
 
      04-28-2004
Richard Herring wrote:
>
> In message <(E-Mail Removed)>, Julie <(E-Mail Removed)>
> 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.
 
Reply With Quote
 
Richard Herring
Guest
Posts: n/a
 
      04-29-2004
In message <(E-Mail Removed)>, Julie <(E-Mail Removed)>
writes
>Richard Herring wrote:
>>
>> In message <(E-Mail Removed)>, Julie <(E-Mail Removed)>
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pls advise on AVL tree Mark C Programming 1 03-29-2012 11:05 PM
URGENT - Pls help...pls recommend - laptop purchase irfansmith@gmail.com Computer Information 2 08-15-2008 11:34 PM
High latency connection - advise, pls BigBen UK VOIP 6 03-18-2006 03:04 AM
User Control Problems, please advise... =?Utf-8?B?Smlt?= ASP .Net 1 09-02-2004 12:49 AM
pls, help.. i need a number..pls olabanji timothy MCSE 7 09-10-2003 04:02 PM



Advertisments