
(std::back_insert_iterator<std::list<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 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, unsigned)': "perl_matcher_non_recursive.hpp": /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' at line 1059
::perl_matcher[in-charge](__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)': "perl_matcher_non_recursive.hpp": /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::get_traits() const' at line 869 ': "basic_string.tcc": /usr/include/c++/3.2.2/bits/basic_string.tcc undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::empty() const' at
::estimate_max_state_count(std::random_access_iterator_tag*)': "regex_grep.hpp": /usr/include/boost/regex/v4/regex_grep.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::size() const' at line 46
Hi, I'm a C++ newbie trying to use the Boost regex libraries. Here's my situation. My system is Red Hat Linux 9, using the Borland C++BuilderX Personal IDE (which uses the g++ compiler). I downloaded and installed Boost from boost.org using the command: bjam -sTOOLS=gcc install The install seemed to complete fine, with 2900+ targets updated. The libraries install in /usr/local/include/boost-1_31/boost. I created the following link: ln -s /usr/local/include/boost-1_31/boost /usr/include/boost I then use C++BuilderX to try and compile one of the example programs for the regex libaries that I found in the documentation. The source code is: /////////////////////// #include <list> #include <boost/regex.hpp> unsigned tokenise(std::list<std::string>& l, std::string& s) { return boost::regex_split(std::back_inserter(l), s); } #include <iostream> using namespace std; #if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) // // problem with std::getline under MSVC6sp3 istream& getline(istream& is, std::string& s) { s.erase(); char c = is.get(); while(c != '\n') { s.append(1, c); c = is.get(); } return is; } #endif int main(int argc) { string s; list<string> l; do{ if(argc == 1) { cout << "Enter text to split (or \"quit\" to exit): "; getline(cin, s); if(s == "quit") break; } else s = "This is a string of tokens"; unsigned result = tokenise(l, s); cout << result << " tokens found" << endl; cout << "The remaining text is: \"" << s << "\"" << endl; while(l.size()) { s = *(l.begin()); l.pop_front(); cout << s << endl; } }while(argc == 1); return 0; } /////////////////////// The compiler returns the following errors: /////////////////////// g++ -c -o /home/sbobrows/cbproject/pmetest/linux/Debug_Build/splittest.o -g2 -O0 -MD -I/usr/include -I/usr/include/g++-3 splittest.cpp g++ -o /home/sbobrows/cbproject/pmetest/linux/Debug_Build/pmetest linux/Debug_Build/splittest.o linux/Debug_Build/splittest.o(.text+0x2c9): In function `__tcf_0': "stl_vector.h": /usr/include/c++/3.2.2/bits/stl_vector.h undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::~reg_expression [in-charge]()' at line 998 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail22get_defau lt_expressionIcEERKNS_14reg_expressionIT_NS_12regex_traitsIS3_EESaIS 3_EEES3_+0x39): In function `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const& boost::re_detail::get_default_expression<char>(char)': "perl_matcher_common.hpp": /usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::reg_expression[in-charge](char const*, unsigned, std::allocator<char> const&)' at line 734 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost11regex_splitISt20bac k_insert_iteratorISt4listISsSaISsEEEcSt11char_traitsIcESaIcENS_12reg ex_traitsIcEES8_EEjT_RSbIT0_T1_T2_ERKNS_14reg_expressionISC_T3_T4_EENS_15reg ex_constants12_match_flagsEj+0x12e): In function `unsigned boost::regex_split<std::back_insert_iterator<std::list<std::basic_string<cha r, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, std::char_traits<char>, std::allocator<char>, boost::regex_traits<char>, std::allocator<char> linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expr essionIcSB_SC_EENS_15regex_constants12_match_flagsE+0x78): 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> line 146 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEE24estimate_max_state_countEPSt26random_access_iterat or_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> linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEE8find_impEv+0xc0): 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()': "regex_grep.hpp": /usr/include/boost/regex/v4/regex_grep.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' at line 49 Build cancelled due to errors linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEE8find_impEv+0x202): 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()': "perl_matcher_non_recursive.hpp": /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' at line 767 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEE8find_impEv+0x290): In function `__static_initialization_and_destruction_0': "perl_matcher_non_recursive.hpp": /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::mark_count() const' at line 1254 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matc herIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_ 12regex_traitsIcEESaIcEE8find_impEv+0x2d7): 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()': "perl_matcher_common.hpp": /usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference to `boost::re_detail::verify_options(unsigned, boost::regex_constants::_match_flags)' at line 821 linux/Debug_Build/splittest.o(.gnu.linkonce.t._ZN5boost9re_detail8access_tIc NS_12regex_traitsIcEESaIcEE5firstERKNS_14reg_expressionIcS3_S4_EE+0x d): 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&)': "regex_split.hpp": /usr/include/boost/regex/v4/regex_split.hpp 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&) at line 36 /////////////////////// After searching around extensively, I've not come up with any solution to my problem. Can someone please point me in the right direction? It seems like I'm just missing some configuration step along the way. Thanks in advance, Steve!