Boost::regex problems.

Hello.
I'm trying to use the Boost regular expressions functions but it fails.
I'm forced to write some programs in C++ at work - I usually work in
java/python and I'm not up to date with C/C++ - and it was recommended I use
the Boost libraries for various utilities.
However, on linux, the regex functions don't work don't work for some
reason. I reinstalled the latest version of the Boost libraries and
everything seems fine (ie, I tried the graph container and it works great).
I tried both on SuSe linux 10.2 and Ubuntu with gcc 4.1.2 and the latest
Boost libs 1.33.1 but it fails at compile time. At first I thought I was
doing something wrong, but then I tried both the examples provided in the
Boost documentation and other examples/tutorials on Boost::regex on the net
(ie ,the ones on OnLAMP of O'Reilly and others) and they fail too with the
same error(s):
"boost_regexp.o: In function `boost::basic_regex

Farraday wrote:
However, on linux, the regex functions don't work don't work for some reason. I reinstalled the latest version of the Boost libraries and everything seems fine (ie, I tried the graph container and it works great). I tried both on SuSe linux 10.2 and Ubuntu with gcc 4.1.2 and the latest Boost libs 1.33.1 but it fails at compile time. At first I thought I was doing something wrong, but then I tried both the examples provided in the Boost documentation and other examples/tutorials on Boost::regex on the net (ie ,the ones on OnLAMP of O'Reilly and others) and they fail too with the same error(s):
"boost_regexp.o: In function `boost::basic_regex
::assign(char const*, char const*, unsigned int)': /usr/include/boost/regex/v4/basic_regex.hpp:254: undefined reference to `boost::basic_regex
>::do_assign(char const*, char const*, unsigned int)'"
The error message you give is from the linker not the compiler: it occurs because you haven't chosen to include the regex binaries in your application. Depending upon how the binaries were built and installed, then appending -lboost_regex to your build command may do the trick. John.
participants (2)
-
Farraday
-
John Maddock