boost::regex_replace compiler error

Discussion in 'C++' started by Yahooooooooo, Jan 22, 2007.

  1. Yahooooooooo

    Yahooooooooo Guest

    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::eek:stringstream osstr(std::ios::eek:ut);
    std::eek:stream_iterator<char> osit(osstr);

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


    boost::regex_replace(osit,line.begin(),line.end(),rex1,post,boost::match_default
    | boost::format_all);

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

    fh.close();
    return 1;
    }

    getting compiler error as below

    # g++ -o runme filename.cc

    /usr/include/g++/stl_uninitialized.h:71: template instantiation depth
    exceeds maximum of 17
    /usr/include/g++/stl_uninitialized.h:71: (use -ftemplate-depth-NN to
    increase the maximum)
    /usr/include/g++/stl_uninitialized.h:71: instantiating
    `__uninitialized_copy_aux<const boost::sub_match<char *> *,
    boost::sub_match<char *> *>(const boost::sub_match<char *> *, const
    boost::sub_match<char *> *, boost::sub_match<char *> *, __false_type)

    ..............................
    ..............................
    ..............................
    Yahooooooooo, Jan 22, 2007
    #1
    1. Advertising

  2. Yahooooooooo

    David Harmon Guest

    On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooooo"
    <> wrote,
    >getting compiler error as below
    >
    ># g++ -o runme filename.cc
    >
    >/usr/include/g++/stl_uninitialized.h:71: template instantiation depth
    >exceeds maximum of 17
    >/usr/include/g++/stl_uninitialized.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?
    David Harmon, Jan 22, 2007
    #2
    1. Advertising

  3. Yahooooooooo

    Yahooooooooo Guest

    Tried the same...

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

    /tmp/ccZsPAPd.o: In function
    `boost::re_detail::basic_regex_creator<char, boost::regex_traits<char,
    boost::c_regex_traits<char> >
    >::basic_regex_creator(boost::re_detail::regex_data<char, boost::regex_traits<char, boost::c_regex_traits<char> > > *)':

    /tmp/ccZsPAPd.o(.gnu.linkonce.t.__Q35boost9re_detailt19basic_regex_creator2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1ZcPQ35boost9re_detailt10regex_data2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1Zc+0x6b):
    undefined reference to
    `boost::c_regex_traits<char>::lookup_classname(char const *, char const
    *)'
    /tmp/ccZsPAPd.o(.gnu.linkonce.t.__Q35boost9re_detailt19basic_regex_creator2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1ZcPQ35boost9re_detailt10regex_data2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1Zc+0x85):
    undefined reference to
    `boost::c_regex_traits<char>::lookup_classname(char const *, char const
    *)'
    /tmp/ccZsPAPd.o(.gnu.linkonce.t.__Q35boost9re_detailt19basic_regex_creator2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1ZcPQ35boost9re_detailt10regex_data2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1Zc+0x9f):
    undefined reference to
    `boost::c_regex_traits<char>::lookup_classname(char const *, char const
    *)'
    /tmp/ccZsPAPd.o(.gnu.linkonce.t.__Q35boost9re_detailt19basic_regex_creator2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1ZcPQ35boost9re_detailt10regex_data2ZcZQ25boostt12regex_traits2ZcZQ25boostt14c_regex_traits1Zc+0xb9):
    undefined reference to
    `boost::c_regex_traits<char>::lookup_classname(char const *, char const
    *)'



    David Harmon wrote:
    > On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooooo"
    > <> wrote,
    > >getting compiler error as below
    > >
    > ># g++ -o runme filename.cc
    > >
    > >/usr/include/g++/stl_uninitialized.h:71: template instantiation depth
    > >exceeds maximum of 17
    > >/usr/include/g++/stl_uninitialized.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?
    Yahooooooooo, Jan 22, 2007
    #3
  4. Yahooooooooo

    Diwa Guest

    David Harmon wrote:
    > On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooooo"
    > <> wrote,
    > >getting compiler error as below
    > >
    > ># g++ -o runme filename.cc
    > >
    > >/usr/include/g++/stl_uninitialized.h:71: template instantiation depth
    > >exceeds maximum of 17
    > >/usr/include/g++/stl_uninitialized.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_dir> -L <boost_lib_dir> -lboost_regex-gcc-d-1_33_1
    filename.cc
    ---------------------------------------------------------

    Thanks
    Diwakar
    Diwa, Jan 24, 2007
    #4
    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. Replies:
    7
    Views:
    1,814
  2. Replies:
    6
    Views:
    383
    Robbie Hatley
    Jul 14, 2006
  3. Yahooooooooo

    boost::regex_replace issue

    Yahooooooooo, Jan 30, 2007, in forum: C++
    Replies:
    1
    Views:
    1,306
    David Harmon
    Jan 31, 2007
  4. Replies:
    1
    Views:
    891
  5. Friedel Jantzen

    regex_replace()

    Friedel Jantzen, May 10, 2011, in forum: C++
    Replies:
    16
    Views:
    1,362
    James Kanze
    May 15, 2011
Loading...

Share This Page