Hi,
the simple code is below:
____________________________________________________________________
#include <iostream>
#include <string>
#include "boost/regex.hpp"
using namespace boost;
regex expression("this is ([[:digit:]]*)");
int main(int argc, char* argv[])
{
while (true)
{
char buf[1000];
memset(buf, 0, 1000);
std::cin.getline(buf, 1000);
std::string str(buf);
cmatch match;
if (!regex_match(str, match, expression))
{
std::cout<<"Don't match"< >, boost::regex_traits<char>, _STL::allocator<char> >::perl_matcher[in-charge](char const*, char const*, boost::match_results > >&, boost::reg_expression const&, boost::regex_constants::_match_flags)':
: undefined reference to `boost::reg_expression::get_traits() const'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIPKcN4_STL9allocatorINS_9sub_matchIS3_EEEENS_12regex_traitsIcEENS5_IcEEEC1ES3_S3_RNS_13match_resultsIS3_S8_EERKNS_14reg_expressionIcSA_SB_EENS_15regex_constants12_match_flagsE+0x8a): In function `boost::re_detail::perl_matcher >, boost::regex_traits<char>, _STL::allocator<char> >::perl_matcher[in-charge](char const*, char const*, boost::match_results > >&, boost::reg_expression const&, boost::regex_constants::_match_flags)':
: undefined reference to `boost::reg_expression::empty() const'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIPKcN4_STL9allocatorINS_9sub_matchIS3_EEEENS_12regex_traitsIcEENS5_IcEEE24estimate_max_state_countEPNS4_26random_access_iterator_tagE+0x2c): In function `boost::re_detail::perl_matcher >, boost::regex_traits<char>, _STL::allocator<char> >::estimate_max_state_count(_STL::random_access_iterator_tag*)':
: undefined reference to `boost::reg_expression::size() const'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIPKcN4_STL9allocatorINS_9sub_matchIS3_EEEENS_12regex_traitsIcEENS5_IcEEE9match_impEv+0x94): In function `boost::re_detail::perl_matcher >, boost::regex_traits<char>, _STL::allocator<char> >::match_imp()':
: undefined reference to `boost::reg_expression::mark_count() const'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEEN4_STL9allocatorIcEEE5firstERKNS_14reg_expressionIcS3_S6_EE+0xd): In function `boost::re_detail::access_t::first(boost::reg_expression const&)':
: undefined reference to `boost::reg_expression::first(boost::reg_expression const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail11raise_errorINS_12regex_traitsIcEEEEvRKT_j+0x21): In function `void boost::re_detail::raise_error(boost::regex_traits<char> const&, unsigned)':
: undefined reference to `boost::re_detail::raise_regex_exception(_STL::basic_string const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEEN4_STL9allocatorIcEEE9can_startEcPKhh+0x24): In function `boost::re_detail::access_t::can_start(char, unsigned char const*, unsigned char)':
: undefined reference to `boost::reg_expression::can_start(char, unsigned char const*, unsigned char, boost::re_detail::_narrow_type const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcEEN4_STL9allocatorIcEEEET_S9_S9_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x41): In function `char const* boost::re_detail::re_is_set_member(char const*, char const*, boost::re_detail::re_set_long const*, boost::reg_expression const&)':
: undefined reference to `boost::reg_expression::get_traits() const'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcEEN4_STL9allocatorIcEEEET_S9_S9_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x258): In function `char const* boost::re_detail::re_is_set_member(char const*, char const*, boost::re_detail::re_set_long const*, boost::reg_expression const&)':
: undefined reference to `boost::c_regex_traits<char>::transform(_STL::basic_string&, _STL::basic_string const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcEEN4_STL9allocatorIcEEEET_S9_S9_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x34b): In function `char const* boost::re_detail::re_is_set_member(char const*, char const*, boost::re_detail::re_set_long const*, boost::reg_expression const&)':
: undefined reference to `boost::c_regex_traits<char>::transform_primary(_STL::basic_string&, _STL::basic_string const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEEN4_STL9allocatorIcEEEC1EPKcjRKS5_+0x13): In function `boost::basic_regex::basic_regex[in-charge](char const*, unsigned, _STL::allocator<char> const&)':
: undefined reference to `boost::reg_expression::reg_expression[not-in-charge](char const*, unsigned, _STL::allocator<char> const&)'
regex_sample.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEEN4_STL9allocatorIcEEED1Ev+0xd): In function `boost::basic_regex::~basic_regex [in-charge]()':
: undefined reference to `boost::reg_expression::~reg_expression [not-in-charge]()'
collect2: ld returned 1 exit status
make: *** [all] Error 1
-------------------------------------------------------------------------------------
the environment is :
linux redhat 9.0
gcc 3.2.2
boost_1_31_0
stlport_4_6_2
Who can help me? thanks
Guan Bin
gb0519@hotmail.com