Problems using Boost, Pls Advise

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sbobrows

    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::l ist<std::string >& l, std::string& s)
    {
    return boost::regex_sp lit(std::back_i nserter(l), s);
    }

    #include <iostream>
    using namespace std;


    #if defined(BOOST_M SVC) || (defined(__BORL ANDC__) && (__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(.te xt+0x2c9): In function `__tcf_0':
    "stl_vector .h": /usr/include/c++/3.2.2/bits/stl_vector.h undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::~reg_express ion [in-charge]()' at line 998
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il22get_default _expressionIcEE RKNS_14reg_expr essionIT_NS_12r egex_traitsIS3_ EESaIS
    3_EEES3_+0x39):
    In function `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> > const&
    boost::re_detai l::get_default_ expression<char >(char)':
    "perl_matcher_c ommon.hpp":
    /usr/include/boost/regex/v4/perl_matcher_co mmon.hpp undefined reference
    to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::reg_expressi on[in-charge](char const*, unsigned,
    std::allocator< char> const&)' at line 734
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost11regex_ splitISt20back_ insert_iterator ISt4listISsSaIS sEEEcSt11char_t raitsIcESaIcENS _12reg
    ex_traitsIcEES8 _EEjT_RSbIT0_T1 _T2_ERKNS_14reg _expressionISC_ T3_T4_EENS_15re gex_constants12 _match_flagsEj+ 0x12e):
    In function `unsigned
    boost::regex_sp lit<std::back_i nsert_iterator< std::list<std:: basic_string<ch ar,
    std::char_trait s<char>, std::allocator< char> >,
    std::allocator< std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, char, std::char_trait s<char>,
    std::allocator< char>, boost::regex_tr aits<char>, std::allocator< char>[color=blue]
    >(std::back_ins ert_iterator<st d::list<std::ba sic_string<char ,[/color]
    std::char_trait s<char>, std::allocator< char> >,
    std::allocator< std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, std::basic_stri ng<char,
    std::char_trait s<char>, std::allocator< char> >&,
    boost::reg_expr ession<char, boost::regex_tr aits<char>,
    std::allocator< char> > const&, boost::regex_co nstants::_match _flags,
    unsigned)':
    "perl_matcher_n on_recursive.hp p":
    /usr/include/boost/regex/v4/perl_matcher_no n_recursive.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::mark_count () const' at line 1059
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEEC1ES6_ S6_RNS_13match_ resultsIS6_S9_E ERKNS_14reg_exp ressionIcSB_SC_ EENS_15regex_co nstants12_match _flagsE+0x78):
    In function
    `boost::re_deta il::perl_matche r<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > >,
    std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, boost::regex_tr aits<char>,
    std::allocator< char>[color=blue]
    >::perl_match er[in-charge](__gnu_cxx::__n ormal_iterator< char const*,[/color]
    std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> >[color=blue]
    >, __gnu_cxx::__no rmal_iterator<c har const*, std::basic_stri ng<char,[/color]
    std::char_trait s<char>, std::allocator< char> > >,
    boost::match_re sults<__gnu_cxx ::__normal_iter ator<char const*,
    std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> >[color=blue]
    >, std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char[/color]
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > > >&, boost::reg_expr ession<char,
    boost::regex_tr aits<char>, std::allocator< char> > const&,
    boost::regex_co nstants::_match _flags)':
    "perl_matcher_n on_recursive.hp p":
    /usr/include/boost/regex/v4/perl_matcher_no n_recursive.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::get_traits () const' at line 869
    ':
    "basic_string.t cc": /usr/include/c++/3.2.2/bits/basic_string.tc c
    undefined reference to `boost::reg_exp ression<char,
    boost::regex_tr aits<char>, std::allocator< char> >::empty() const' at
    line 146
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEE24esti mate_max_state_ countEPSt26rand om_access_itera tor_tag+0x30):
    In function
    `boost::re_deta il::perl_matche r<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > >,
    std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, boost::regex_tr aits<char>,
    std::allocator< char>[color=blue]
    >::estimate_max _state_count(st d::random_acces s_iterator_tag* )':[/color]
    "regex_grep.hpp ": /usr/include/boost/regex/v4/regex_grep.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::size() const' at line 46
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEE8find_ impEv+0xc0):
    In function
    `boost::re_deta il::perl_matche r<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > >,
    std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, boost::regex_tr aits<char>,
    std::allocator< char> >::find_imp() ':
    "regex_grep.hpp ": /usr/include/boost/regex/v4/regex_grep.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::mark_count () const' at line 49
    Build cancelled due to errors
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEE8find_ impEv+0x202):
    In function
    `boost::re_deta il::perl_matche r<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > >,
    std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, boost::regex_tr aits<char>,
    std::allocator< char> >::find_imp() ':
    "perl_matcher_n on_recursive.hp p":
    /usr/include/boost/regex/v4/perl_matcher_no n_recursive.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::mark_count () const' at line 767
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEE8find_ impEv+0x290):
    In function `__static_initi alization_and_d estruction_0':
    "perl_matcher_n on_recursive.hp p":
    /usr/include/boost/regex/v4/perl_matcher_no n_recursive.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::mark_count () const' at line 1254
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il12perl_matche rIN9__gnu_cxx17 __normal_iterat orIPKcSsEESaINS _9sub_matchIS6_ EEENS_
    12regex_traitsI cEESaIcEE8find_ impEv+0x2d7):
    In function
    `boost::re_deta il::perl_matche r<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > >,
    std::allocator< boost::sub_matc h<__gnu_cxx::__ normal_iterator <char
    const*, std::basic_stri ng<char, std::char_trait s<char>,
    std::allocator< char> > > > >, boost::regex_tr aits<char>,
    std::allocator< char> >::find_imp() ':
    "perl_matcher_c ommon.hpp":
    /usr/include/boost/regex/v4/perl_matcher_co mmon.hpp undefined reference
    to `boost::re_deta il::verify_opti ons(unsigned,
    boost::regex_co nstants::_match _flags)' at line 821
    linux/Debug_Build/splittest.o(.gn u.linkonce.t._Z N5boost9re_deta il8access_tIcNS _12regex_traits IcEESaIcEE5firs tERKNS_14reg_ex pressionIcS3_S4 _EE+0x
    d):
    In function `boost::re_deta il::access_t<ch ar, boost::regex_tr aits<char>,
    std::allocator< char> >::first(boost: :reg_expression <char,
    boost::regex_tr aits<char>, std::allocator< char> > const&)':
    "regex_split.hp p": /usr/include/boost/regex/v4/regex_split.hpp undefined
    reference to `boost::reg_exp ression<char, boost::regex_tr aits<char>,
    std::allocator< char> >::first(boost: :reg_expression <char,
    boost::regex_tr aits<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++.m oderated. First time posters: Do this! ]
  • Julie

    #2
    Re: Problems using Boost, Pls Advise

    sbobrows wrote:[color=blue]
    >
    > {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}[/color]
    [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.

    Comment

    • Steve Bobrowski

      #3
      Re: Problems using Boost, Pls Advise

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

      Thanks for your direction!

      Steve

      "Julie" <julie@nospam.c om> wrote in message
      news:408E832B.9 A5693C4@nospam. com...[color=blue]
      > sbobrows wrote:[color=green]
      > >
      > > {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}[/color]
      > [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.[/color]


      Comment

      • Julie

        #4
        Re: Problems using Boost, Pls Advise

        sbobrows wrote:[color=blue]
        >
        > {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}[/color]
        [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++.m oderated. First time posters: Do this! ]

        Comment

        • llewelly

          #5
          Re: Problems using Boost, Pls Advise

          sbobrows <sbobrows@anima tedlearning.com > writes:
          [color=blue]
          > {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:
          >[/color]
          {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++.m oderated. First time posters: Do this! ]

          Comment

          • Richard Herring

            #6
            Re: Problems using Boost, Pls Advise

            In message <408E8252.90D1E 64F@nospam.com> , Julie <julie@nospam.c om>
            writes[color=blue]
            >sbobrows wrote:[color=green]
            > >
            > > {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}[/color]
            >[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.[/color]

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

            --
            Richard Herring

            Comment

            • Julie

              #7
              Re: Problems using Boost, Pls Advise

              Richard Herring wrote:[color=blue]
              >
              > In message <408E8252.90D1E 64F@nospam.com> , Julie <julie@nospam.c om>
              > writes[color=green]
              > >sbobrows wrote:[color=darkred]
              > > >
              > > > {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}[/color]
              > >[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.[/color]
              >
              > If it's server-specific, is it really a "newsgroup" ?[/color]

              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.

              Comment

              • Richard Herring

                #8
                Re: Problems using Boost, Pls Advise

                In message <408FD18D.C9502 85E@nospam.com> , Julie <julie@nospam.c om>
                writes[color=blue]
                >Richard Herring wrote:[color=green]
                >>
                >> In message <408E8252.90D1E 64F@nospam.com> , Julie <julie@nospam.c om>
                >> writes[color=darkred]
                >> >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.[/color]
                >>
                >> If it's server-specific, is it really a "newsgroup" ?[/color]
                >
                >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.[/color]

                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

                Comment

                Working...