
On Tue, 7 Nov 2006, John Maddock wrote:
Charles Fox wrote:
Hi there, I'm new to boost, and am trying to install and test it on a Fedora FC3 machine with gcc 3.4.3. I have installed boost into the default locations /usr/local/lib and /usr/local/include/boost-1_33_1 respectively with bjam as instructed. I then try to compile the example regex program (copied below) with this command:
g++ -L/usr/local/lib -I/usr/local/include/boost-1_33_1 -lboost_regex-gcc-1_33_1 test.cpp
but I get this error: test.cpp: In function `void print_captures(const std::string&, const std::string&)': test.cpp:23: error: 'class boost::smatch' has no member named 'captures' test.cpp:29: error: 'class boost::smatch' has no member named 'captures'
Two points: the -l option always has to appear *after* the source files that need the library in question, and the extended-captures information is only available when both the library, *and* your code is built with BOOST_REGEX_MATCH_EXTRA defined. See http://www.boost.org/libs/regex/doc/captures.html for documentation explaining this. Also note that building with BOOST_REGEX_MATCH_EXTRA defined is likely to have an impact on regex performance - you only need it if you really want to capture all occurances of a repeated sub-expression: normal perl-style sub-expression's work just fine without it.
HTH, John.
Thanks -- I did not realize captures were an optional extra -- yes I am happy with the other perl-style matching. charles