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::fail(unsigned int)':
/tmp/cc9r42Gv.o(.boost::reg_expression
::gnu.linkonce.t.fail(unsigned int)+0x4e): undefined reference to
`boost::bad_expression::bad_expression(basic_string > const
&)'
/tmp/cc9r42Gv.o: In function `boost::reg_expression >,
allocator<char> > &, boost::re_detail::jstack >,
allocator<char> > &, boost::re_detail::jstack &, boost::re_detail::jstack >,
allocator<char> > &, bool, boost::re_detail::_narrow_type const &)':
.
.
.
Here is the source to te1.cc
----
#include <iostream>
#include <string>
#include
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?