
I have #included
in a file but get the following compile time error: /tmp/ccXM0HkR.o: In function `boost::basic_regex
>::assign(char const*, char const*, unsigned int)': contact.cpp:(.text._ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[boost::basic_regex >::assign(char const*, char const*, unsigned int)]+0x27): undefined reference to `boost::basic_regex ::do_assign(char const*, char const*, unsigned int)'
collect2: ld returned 1 exit status
This file definitely exists at /usr/include/boost/regex.hpp. Another Boost #include in the same file (
) produces no error. 'ldconfig -p' lists libboost_regex.so. What am I doing wrong?
First off it's not a compile time error - it's a linker error - the linker is saying that some symbols used by your program can't be found. In short you need to add a reference to libboost_regex on the command line, something like: g++ myfile.cpp -lboost_regex HTH, John.