Boost logo

Boost Users :

From: the_3_project (the_3_project_at_[hidden])
Date: 2002-05-19 22:18:21


How do I compile a program that uses the libregex program? It seems
that whenever I do this:
 
$ gcc -o te1 te1.cc -lboost_regex
 
I get:
 
----
/tmp/cc9r42Gv.o: In function `boost::reg_expression<char,
boost::regex_traits<char>, allocator<char> >::fail(unsigned int)':
/tmp/cc9r42Gv.o(.boost::reg_expression<char,
boost::regex_traits<char>, allocator<char>
>::gnu.linkonce.t.fail(unsigned int)+0x4e): undefined reference to
`boost::bad_expression::bad_expression(basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> > const
&)'
/tmp/cc9r42Gv.o: In function `boost::reg_expression<char,
boost::regex_traits<char>, allocator<char>
>::compile_set_aux(boost::re_detail::jstack<basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >,
allocator<char> > &, boost::re_detail::jstack<basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >,
allocator<char> > &, boost::re_detail::jstack<unsigned int,
allocator<char> > &, boost::re_detail::jstack<basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >,
allocator<char> > &, bool, boost::re_detail::_narrow_type const &)':
.
.
.
----
 
Here is the source to te1.cc
 
----
#include <iostream>
#include <string>
#include <boost/regex.hpp>
 
using namespace boost;
 
 
int main(int argc, char *argv[])
{
 
  cmatch what;
  string str = "XXyX";
 
  regex expression("(\\S\\S){[Ayw]}(\\S)/");
 
  if(regex_match(str,what,expression)) {
    cout << "what" << endl;
  }
  else {
    cout << "Shit\n";
  }
 
  return 0;
}
--------
 
What am I doing wrong?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net