Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-08-04 22:56:57


On Saturday 04 August 2001 08:44, you wrote:
[snip]
> Linking regex_match_example.o ...
> g++ \
> -L/usr/lib/boost_1_23_0/libs/regex/build/gcc\
> -lboost_regex\
> regex_match_example.o\
> -o reTEST

It's a linking order problem (note the "undefined reference" errors below).
The linker won't add anything from a library (.a) that it doesn't think will
be needed, and won't revisit prior libraries. So it adds nothing from
libboost_regex.a, and then comes up short when regex_match_example.o
references parts of libboost_regex.a (which has long been forgotten). Just
swap the order of the two:
g++ -L/usr/lib/boost_1_23_0/libs/regex/build/gcc regex_match_example.o
-lboost_regex -o reTEST

> //first three errors:
> regex_match_example.o: In function `char const*
> boost::re_detail::re_is_set_member<char const*, char,
> boost::regex_traits<char>, boost::re_detail::jm_def_alloc>(char
> const*, char const*, boost::re_detail::re_set_long*,
> boost::reg_expression<char, boost::regex_traits<char>,
> boost::re_detail::jm_def_alloc> const&)':
> regex_match_example.o
> (.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_
> traitsIcEENS0_12jm_def_allocEEET_S7_S7_PNS0_11re_set_longERKNS_14reg_e
> xpressionIT0_T1_T2_EE+0x29c): undefined reference to
> `boost::c_regex_traits<char>::transform(std::string&, std::string
> const&)'
> regex_match_example.o
> (.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_
> traitsIcEENS0_12jm_def_allocEEET_S7_S7_PNS0_11re_set_longERKNS_14reg_e
> xpressionIT0_T1_T2_EE+0x3b9): undefined reference to
> `boost::c_regex_traits<char>::transform_primary(std::string&,
> std::string const&)'

        Doug


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