Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-11-07 12:19:01


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk