[regex] undefined references to boost::reg_expression

I've been able to build this program without problem on one RHEL4 machine with boost 1.33.1. But on another machine it gives a ton of errors (see below). Any thoughts would be greatly appreciated. Thanks, Ken #include <iostream> #include <string> #include "boost/regex.hpp" using namespace boost; using namespace std; int main() { string _stream("1000_===_1181763561847_===_false"); boost::sregex_token_iterator _tokens, _end; _tokens = sregex_token_iterator(_stream.begin(), _stream.end(), regex("_===_", boost::regex::literal), -1); while(_tokens != _end) { cout << *_tokens++ << endl; } } make -f sample.mak all make[1]: Entering directory `/users/sd/jbfsa/bolanosr/dci_test/DciSample' g++ -Wall -g -D__OS_LINUX__ -pthread -I../DciApi/include -I../DciApi -I../boost_release/boost -c -o DciSample.o DciSample.cpp g++ DciSample.o -L../DciApi -lDciApi -L../boost_release/libs -lboost_date_time-gcc-mt -lboost_filesystem-gcc-mt -lboost_iostreams-gcc-mt -lboost_program_options-gcc-mt -lboost_regex-gcc-mt -lboost_serialization-gcc-mt -lboost_signals-gcc-mt -lboost_thread-gcc-mt -lboost_wave-gcc-mt -o DciSample g++ -Wall -g -D__OS_LINUX__ -pthread -I../DciApi/include -I../DciApi -I../boost_release/boost -c -o TestBoost.o TestBoost.cpp g++ TestBoost.o -L../DciApi -lDciApi -L../boost_release/libs -lboost_date_time-gcc-mt -lboost_filesystem-gcc-mt -lboost_iostreams-gcc-mt -lboost_program_options-gcc-mt -lboost_regex-gcc-mt -lboost_serialization-gcc-mt -lboost_signals-gcc-mt -lboost_thread-gcc-mt -lboost_wave-gcc-mt -o TestBoost TestBoost.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEEC1EPKcjRKS3_+0x13): In function `boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::basic_regex(char const*, unsigned int, std::allocator<char> const&)': /usr/include/boost/regex/v4/basic_regex.hpp:340: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char>
::reg_expression(char const*, unsigned int, std::allocator<char> const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEED1Ev+0xd): In function `boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::~basic_regex()': /usr/include/boost/regex/v4/basic_regex.hpp:347: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::~reg_expression()' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0x7e): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > , boost::regex_traits<char>, std::allocator<char> ::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > &, boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&, boost::regex_constants::_match_flags)': /usr/include/boost/regex/v4/perl_matcher_common.hpp:42: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::get_traits() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0xb7):/usr/include/boost/regex/v4/perl_matcher_common.hpp:45: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::empty() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEE24estimate_max_state_countEPSt26random_access_iterator_tag+0x30): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > , boost::regex_traits<char>, std::allocator<char> ::estimate_max_state_count(std::random_access_iterator_tag*)': /usr/include/boost/regex/v4/perl_matcher_common.hpp:79: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::size() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEE8find_impEv+0xc6): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > , boost::regex_traits<char>, std::allocator<char> >::find_imp()': /usr/include/boost/regex/v4/perl_matcher_common.hpp:201: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEE8find_impEv+0x206):/usr/include/boost/regex/v4/perl_matcher_common.hpp:219: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEE8find_impEv+0x294):/usr/include/boost/regex/v4/perl_matcher_common.hpp:225: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' TestBoost.o(.gnu.linkonce.t._ZN5boost14c_regex_traitsIcE8is_classEcj+0x14): In function `boost::c_regex_traits<char>::is_class(char, unsigned int)': /usr/include/boost/regex/v4/regex_traits.hpp:219: undefined reference to `boost::re_detail::c_traits_base::class_map' TestBoost.o(.gnu.linkonce.t._ZN5boost14c_regex_traitsIcE9translateEcb+0x1f): In function `boost::c_regex_traits<char>::translate(char, bool)': /usr/include/boost/regex/v4/regex_traits.hpp:201: undefined reference to `boost::re_detail::c_traits_base::lower_case_map' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEESaIcEE5firstERKNS_14reg_expressionIcS3_S4_EE+0xd): In function `boost::re_detail::access_t<char, boost::regex_traits<char>, std::allocator<char> >::first(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)': /usr/include/boost/regex/v4/perl_matcher.hpp:181: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::first(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEESaIcEE12restart_typeERKNS_14reg_expressionIcS3_S4_EE+0xd): In function `boost::re_detail::access_t<char, boost::regex_traits<char>, std::allocator<char> >::restart_type(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)': /usr/include/boost/regex/v4/perl_matcher.hpp:179: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::restart_type(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEESaIcEE7get_mapERKNS_14reg_expressionIcS3_S4_EE+0xd): In function `boost::re_detail::access_t<char, boost::regex_traits<char>, std::allocator<char> >::get_map(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)': /usr/include/boost/regex/v4/perl_matcher.hpp:183: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::get_map(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEESaIcEE9can_startEcPKhh+0x24): In function `boost::re_detail::access_t<char, boost::regex_traits<char>, std::allocator<char> >::can_start(char, unsigned char const*, unsigned char)': /usr/include/boost/regex/v4/perl_matcher.hpp:190: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::can_start(char, unsigned char const*, unsigned char, boost::re_detail::_narrow_type const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIcNS_12regex_traitsIcEESaIcEE7get_kmpERKNS_14reg_expressionIcS3_S4_EE+0xd): In function `boost::re_detail::access_t<char, boost::regex_traits<char>, std::allocator<char> >::get_kmp(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)': /usr/include/boost/regex/v4/perl_matcher.hpp:187: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::get_kmp(boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail11raise_errorINS_12regex_traitsIcEEEEvRKT_j+0x15): In function `void boost::re_detail::raise_error<boost::regex_traits<char> (boost::regex_traits<char> const&, unsigned int)': /usr/include/boost/regex/config.hpp:439: undefined reference to `boost::re_detail::c_traits_base::error_string(unsigned int)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail11raise_errorINS_12regex_traitsIcEEEEvRKT_j+0x21):/usr/include/boost/regex/config.hpp:439: undefined reference to `boost::re_detail::raise_regex_exception(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcEESaIcEEET_SA_SA_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x61): In function `__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::re_detail::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, boost::regex_traits<char>, std::allocator<char> (__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::re_detail::re_set_long const*, boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&)': /usr/include/boost/regex/v4/perl_matcher.hpp:74: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::get_traits() const' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcEESaIcEEET_SA_SA_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x2e8):/usr/include/boost/regex/v4/perl_matcher.hpp:126: undefined reference to `boost::c_regex_traits<char>::transform(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' TestBoost.o(.gnu.linkonce.t._ZN5boost9re_detail16re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcEESaIcEEET_SA_SA_PKNS0_11re_set_longERKNS_14reg_expressionIT0_T1_T2_EE+0x3e0):/usr/include/boost/regex/v4/perl_matcher.hpp:151: undefined reference to `boost::c_regex_traits<char>::transform_primary(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: ld returned 1 exit status make[1]: *** [TestBoost] Error 1

Ken Klose wrote:
I've been able to build this program without problem on one RHEL4 machine with boost 1.33.1. But on another machine it gives a ton of errors (see below).
Any thoughts would be greatly appreciated.
I'm not completely sure, but it looks like you may be #including an older version of Boost.Regex and then trying to link against the 1.33.1 binaries? John.
participants (2)
-
John Maddock
-
Ken Klose