boost::regex_replace compiler error

Y

Yahooooooooo

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)

..............................
..............................
..............................
 
D

David Harmon

On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooooo"
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?
 
Y

Yahooooooooo

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 said:
::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
*)'
 
D

Diwa

David said:
On 21 Jan 2007 21:26:10 -0800 in comp.lang.c++, "Yahooooooooo"


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:
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top