Problems using Boost, Pls Advise

Discussion in 'C++' started by sbobrows, Apr 27, 2004.

  1. sbobrows

    sbobrows Guest

    {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_detail22get_default_expressionIcEERKNS_14reg_expressionIT_NS_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>(char)':
    "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_splitISt20back_insert_iteratorISt4listISsSaISsEEEcSt11char_traitsIcESaIcENS_12reg
    ex_traitsIcEES8_EEjT_RSbIT0_T1_T2_ERKNS_14reg_expressionISC_T3_T4_EENS_15regex_constants12_match_flagsEj+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_string<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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_
    12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0x78):
    In function
    `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
    const*, std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_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::__normal_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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_
    12regex_traitsIcEESaIcEE24estimate_max_state_countEPSt26random_access_iterator_tag+0x30):
    In function
    `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
    const*, std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_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_iterator_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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_
    12regex_traitsIcEESaIcEE8find_impEv+0xc0):
    In function
    `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
    const*, std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_
    12regex_traitsIcEESaIcEE8find_impEv+0x202):
    In function
    `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
    const*, std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_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_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_
    12regex_traitsIcEESaIcEE8find_impEv+0x2d7):
    In function
    `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
    const*, std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >,
    std::allocator<boost::sub_match<__gnu_cxx::__normal_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_detail8access_tIcNS_12regex_traitsIcEESaIcEE5firstERKNS_14reg_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! ]
    sbobrows, Apr 27, 2004
    #1
    1. Advertising

  2. sbobrows

    Julie Guest

    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.
    Julie, Apr 27, 2004
    #2
    1. Advertising

  3. No, I did not. Sorry, I'll repost this there.

    Thanks for your direction!

    Steve

    "Julie" <> wrote in message
    news:...
    > 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.
    Steve Bobrowski, Apr 27, 2004
    #3
  4. sbobrows

    Julie Guest

    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! ]
    Julie, Apr 28, 2004
    #4
  5. sbobrows

    llewelly Guest

    sbobrows <> 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! ]
    llewelly, Apr 28, 2004
    #5
  6. In message <>, Julie <>
    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
    Richard Herring, Apr 28, 2004
    #6
  7. sbobrows

    Julie Guest

    Richard Herring wrote:
    >
    > In message <>, Julie <>
    > 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.
    Julie, Apr 28, 2004
    #7
  8. In message <>, Julie <>
    writes
    >Richard Herring wrote:
    >>
    >> In message <>, Julie <>
    >> 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
    Richard Herring, Apr 29, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Smlt?=

    User Control Problems, please advise...

    =?Utf-8?B?Smlt?=, Sep 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    342
    =?Utf-8?B?U2hhaWxlc2ggSmFubnU=?=
    Sep 2, 2004
  2. Richard Latter
    Replies:
    2
    Views:
    2,899
    Julie
    May 17, 2004
  3. g
    Replies:
    3
    Views:
    681
  4. Toby Bradshaw
    Replies:
    6
    Views:
    1,746
    Kai-Uwe Bux
    Jun 2, 2006
  5. Mark

    pls advise on AVL tree

    Mark, Mar 29, 2012, in forum: C Programming
    Replies:
    1
    Views:
    327
    Jorgen Grahn
    Mar 30, 2012
Loading...

Share This Page