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?
Oops.. It was in fact 'g++' that I used. --- Paul Dubuc <pdubuc@cas.org> wrote:
the_3_project wrote:
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
Use g++, not gcc.
------------------------ Yahoo! Groups Sponsor
Info: <http://www.boost.org> Wiki:
<http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
__________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com
participants (3)
-
Paul Dubuc
-
Tha Project
-
the_3_project