Hi everyone. I'm using the libboost-regex Debian package and I'm trying to compile one of the example programs, regex_match_example.cpp. I am compiling with the command g++ -g -Wall -lboost_regex regex_match_example.cpp \ -o regex_match_example but I get many errors: /tmp/ccCZxmp1.o: In function __static_initialization_and_destruction_0': /home/cameron/src/xml-unix/progs/grep/regex_match_example.cpp:31: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, allocator<char> >::reg_expression(char const *, unsigned int, allocator<char> const &)' /home/cameron/src/xml-unix/progs/grep/regex_match_example.cpp:31: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, allocator<char> >::~reg_expression(void)' /tmp/ccCZxmp1.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0>
::assign(char const *, unsigned int)': /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data<char const *, allocator<char> >::gnu.linkonce.t.m_free(void)+0x20): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> >::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data<char const *, allocator<char> >::gnu.linkonce.t.m_free(void)+0xbe): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> >::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data<char const *, allocator<char> ::gnu.linkonce.t.(boost::re_detail::match_results_base<char const *, allocator<char> > const &)+0x26): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data<char const *, allocator<char> ::gnu.linkonce.t.(boost::re_detail::match_results_base<char const *, allocator<char> > const &)+0x6d): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data<char const *, allocator<char> ::gnu.linkonce.t.(boost::re_detail::match_results_base<char const *, allocator<char> > const &)+0xb2): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::allocator(void) const' /tmp/ccCZxmp1.o(.boost::re_detail::_priv_match_data<char const *, allocator<char> >::gnu.linkonce.t.set_accumulator_size(unsigned int)+0x37):/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h: more undefined references to `boost::re_detail::match_results_base<char const *, allocator<char> >::allocator(void) const' follow /tmp/ccCZxmp1.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> ::assign(char const *, unsigned int)': /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::match_results_base<char const *, allocator<char> >::gnu.linkonce.t.set_second(char const *)+0x13): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::cow(void)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.gnu.linkonce.t.__as__Q35boost9re_detailt18match_results_base2ZPCcZt9allocator1ZcRCQ35boost9re_detailt18match_results_base2ZPCcZt9allocator1Zc+0x19): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> >::m_free(void)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::match_results_base<char const *, allocator<char> >::gnu.linkonce.t.set_second(char const *, unsigned int, bool)+0x1a): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::cow(void)' /tmp/ccCZxmp1.o: In function `main': /home/cameron/src/xml-unix/progs/grep/regex_match_example.cpp:89: undefined reference to `boost::c_regex_traits<char>::transform(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > &, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &)' /home/cameron/src/xml-unix/progs/grep/regex_match_example.cpp:99: undefined reference to `boost::c_regex_traits<char>::transform_primary(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > &, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &)' /tmp/ccCZxmp1.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> ::assign(char const *, unsigned int)': /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.bool boost::re_detail::gnu.linkonce.t.query_match_aux<char const *, allocator<char>, char, boost::regex_traits<char>, allocator<char> >(char const *, char const *, boost::match_results<char const *, allocator<char> > &, boost::reg_expression<char, boost::regex_traits<char>, allocator<char> > const &, unsigned int, boost::re_detail::_priv_match_data<char const *, allocator<char> > &, char const * *)+0x77): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::set_first(char const *)' /tmp/ccCZxmp1.o: In function `main': /home/cameron/src/xml-unix/progs/grep/regex_match_example.cpp:95: undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> >::set_first(char const *, unsigned int)' /tmp/ccCZxmp1.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> ::assign(char const *, unsigned int)': /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.bool boost::gnu.linkonce.t.regex_match<char const *, allocator<char>, char, boost::regex_traits<char>, allocator<char> >(char const *, char const *, boost::match_results<char const *, allocator<char> > &, boost::reg_expression<char, boost::regex_traits<char>, allocator<char> > const &, unsigned int)+0x34): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::set_size(unsigned int, char const *, char const *)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.gnu.linkonce.t._._Q35boost9re_detailt18match_results_base2ZPCcZt9allocator1Zc+0x13): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> >::m_free(void)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::match_results<char const *, allocator<char> >::gnu.linkonce.t.(allocator<char> const &)+0x14): undefined reference to `boost::re_detail::match_results_base<char const *, allocator<char> ::match_results_base(allocator<char> const &)'
collect2: ld returned 1 exit status make: *** [regex_match_example] Error 1
(Sorry for the messiness, I can't get Mozilla not to wrap those error lines.) Anyone know what is going on here (a template instantiation problem perhaps)? Thanks, Cameron -- Cameron McCormack // clm@csse.monash.edu.au // http://www.csse.monash.edu.au/~clm/ // icq 26955922
I'm using the libboost-regex Debian package and I'm trying to compile one of the example programs, regex_match_example.cpp.
I am compiling with the command
g++ -g -Wall -lboost_regex regex_match_example.cpp \ -o regex_match_example
gcc is sensitive to library ordering, put the -lboost_regex after the file that needs it. John Maddock http://ourworld.compuserve.com/homepages/john_maddock/index.htm
Hi John. John Maddock wrote:
gcc is sensitive to library ordering, put the -lboost_regex after the file that needs it.
Unforunately it didn't fix the problem. I'll try compiling the library from source and see where that gets me. Cameron -- Cameron McCormack // clm@csse.monash.edu.au // http://www.csse.monash.edu.au/~clm/ // icq 26955922
Cameron McCormack wrote:
but I get many errors:
Compiling the library from sources fixed the problem. -- Cameron McCormack // clm@csse.monash.edu.au // http://www.csse.monash.edu.au/~clm/ // icq 26955922
participants (2)
-
Cameron McCormack
-
John Maddock