
Hello,Sir and everybody.
Presumably you need to add the -lboost_regex to your linkers command line.
OK,it worked!! Thank you for your advice. I'v change my test program a little. ************************** #include <iostream> #include <boost/regex.hpp> using namespace std; using namespace boost; int main() { const char* re ="[0-9](.*)"; regex expression(re); const char* str= "1234567890"; cmatch what; regex_match(str,what,expression); cout << "success" <<endl; } *************************** and Makefile also, *************************** a.out: main.o gcc -lboost_regex -o a.out main.o main.o: main.cpp gcc -c main.cpp *********************************************************** Shintarou Fujiwara Officer,System-Informations,Signal School,JGSDF *********************************************************** On Sun, 4 Dec 2005 10:22:13 -0000 "John Maddock" <john@johnmaddock.co.uk> wrote:
Hi, from Japan.I'm pretty new to c++ and I'm trying to work out on regex. When I compile these lines,it ends with "undefined reference to ..." Please let me know how to use regex properly. I use on FC4 and newest boost version,compiling in Anjuta.
You don't say what compiler you're using? Presumably you need to add the -lboost_regex to your linkers command line.
Note also that [0-9] will only match the first character of "1234567890" so the call to regex_match will fail (regex_match requires that the whole of the text is matched in order to succeed). Use regex_search if you want to match a sub-string of the text.
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users