boost::regex_replace compiler error

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

    boost::regex_replace compiler error

    Hi,

    whats the issue in below code ...

    #include <iostream>
    #include <fstream>
    #include <sstream>
    #include <string>
    #include <iterator>
    #include <boost/regex.hpp>
    using namespace std;

    extern const char* pre= " "; // i want to remove space
    extern const char* post="";

    int main(void)
    {
    string line;
    boost::regex rex1(pre);
    std::ostringstr eam osstr(std::ios: :out);
    std::ostream_it erator<charosit (osstr);

    ifstream fh("/tmp/log.conf");
    getline(fh,line );
    cout << line << endl;


    boost::regex_re place(osit,line .begin(),line.e nd(),rex1,post, boost::match_de fault
    | boost::format_a ll);

    //cout <<"--"<<rex1.str()<< "--"<<endl;

    fh.close();
    return 1;
    }

    getting compiler error as below

    # g++ -o runme filename.cc

    /usr/include/g++/stl_uninitializ ed.h:71: template instantiation depth
    exceeds maximum of 17
    /usr/include/g++/stl_uninitializ ed.h:71: (use -ftemplate-depth-NN to
    increase the maximum)
    /usr/include/g++/stl_uninitializ ed.h:71: instantiating
    `__uninitialize d_copy_aux<cons t boost::sub_matc h<char **,
    boost::sub_matc h<char **>(const boost::sub_matc h<char **, const
    boost::sub_matc h<char **, boost::sub_matc h<char **, __false_type)

    ............... ...............
    ............... ...............
    ............... ...............

  • David Harmon

    #2
    Re: boost::regex_re place compiler error

    On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooo oo"
    <m.azmath@gmail .comwrote,
    >getting compiler error as below
    >
    ># g++ -o runme filename.cc
    >
    >/usr/include/g++/stl_uninitializ ed.h:71: template instantiation depth
    >exceeds maximum of 17
    >/usr/include/g++/stl_uninitializ ed.h:71: (use -ftemplate-depth-NN to
    >increase the maximum)
    Is there some reason you did not do what the message told you to do?

    Comment

    • Yahooooooooo

      #3
      Re: boost::regex_re place compiler error

      Tried the same...

      # g++ -ftemplate-depth-100 -o runme filename.cc

      /tmp/ccZsPAPd.o: In function
      `boost::re_deta il::basic_regex _creator<char, boost::regex_tr aits<char,
      boost::c_regex_ traits<char
      >::basic_regex_ creator(boost:: re_detail::rege x_data<char, boost::regex_tr aits<char, boost::c_regex_ traits<char *)':
      /tmp/ccZsPAPd.o(.gnu .linkonce.t.__Q 35boost9re_deta ilt19basic_rege x_creator2ZcZQ2 5boostt12regex_ traits2ZcZQ25bo ostt14c_regex_t raits1ZcPQ35boo st9re_detailt10 regex_data2ZcZQ 25boostt12regex _traits2ZcZQ25b oostt14c_regex_ traits1Zc+0x6b) :
      undefined reference to
      `boost::c_regex _traits<char>:: lookup_classnam e(char const *, char const
      *)'
      /tmp/ccZsPAPd.o(.gnu .linkonce.t.__Q 35boost9re_deta ilt19basic_rege x_creator2ZcZQ2 5boostt12regex_ traits2ZcZQ25bo ostt14c_regex_t raits1ZcPQ35boo st9re_detailt10 regex_data2ZcZQ 25boostt12regex _traits2ZcZQ25b oostt14c_regex_ traits1Zc+0x85) :
      undefined reference to
      `boost::c_regex _traits<char>:: lookup_classnam e(char const *, char const
      *)'
      /tmp/ccZsPAPd.o(.gnu .linkonce.t.__Q 35boost9re_deta ilt19basic_rege x_creator2ZcZQ2 5boostt12regex_ traits2ZcZQ25bo ostt14c_regex_t raits1ZcPQ35boo st9re_detailt10 regex_data2ZcZQ 25boostt12regex _traits2ZcZQ25b oostt14c_regex_ traits1Zc+0x9f) :
      undefined reference to
      `boost::c_regex _traits<char>:: lookup_classnam e(char const *, char const
      *)'
      /tmp/ccZsPAPd.o(.gnu .linkonce.t.__Q 35boost9re_deta ilt19basic_rege x_creator2ZcZQ2 5boostt12regex_ traits2ZcZQ25bo ostt14c_regex_t raits1ZcPQ35boo st9re_detailt10 regex_data2ZcZQ 25boostt12regex _traits2ZcZQ25b oostt14c_regex_ traits1Zc+0xb9) :
      undefined reference to
      `boost::c_regex _traits<char>:: lookup_classnam e(char const *, char const
      *)'



      David Harmon wrote:
      On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooo oo"
      <m.azmath@gmail .comwrote,
      getting compiler error as below

      # g++ -o runme filename.cc

      /usr/include/g++/stl_uninitializ ed.h:71: template instantiation depth
      exceeds maximum of 17
      /usr/include/g++/stl_uninitializ ed.h:71: (use -ftemplate-depth-NN to
      increase the maximum)
      >
      Is there some reason you did not do what the message told you to do?

      Comment

      • Diwa

        #4
        Re: boost::regex_re place compiler error


        David Harmon wrote:
        On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooo oo"
        <m.azmath@gmail .comwrote,
        getting compiler error as below

        # g++ -o runme filename.cc

        /usr/include/g++/stl_uninitializ ed.h:71: template instantiation depth
        exceeds maximum of 17
        /usr/include/g++/stl_uninitializ ed.h:71: (use -ftemplate-depth-NN to
        increase the maximum)
        >
        Is there some reason you did not do what the message told you to do?
        Some libs of boost require a library while most can be used by just
        including header files.
        Regex of boost requires a library. (Build it first from sources)

        The error goes away when I use following:
        ---------------------------------------------------------
        g++ -I<boost_incl_di r -L <boost_lib_di r -lboost_regex-gcc-d-1_33_1
        filename.cc
        ---------------------------------------------------------

        Thanks
        Diwakar

        Comment

        Working...