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
::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
::gnu.linkonce.t.m_free(void)+0x20): undefined reference to `boost::re_detail::match_results_base ::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data ::gnu.linkonce.t.m_free(void)+0xbe): undefined reference to `boost::re_detail::match_results_base ::allocator(void) const' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::_priv_match_data const &)+0x26): undefined reference to `boost::re_detail::match_results_base const &)+0x6d): undefined reference to `boost::re_detail::match_results_base const &)+0xb2): undefined reference to `boost::re_detail::match_results_base ::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 ::allocator(void) const' follow /tmp/ccCZxmp1.o: In function `basic_string ::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 ::gnu.linkonce.t.set_second(char const *)+0x13): undefined reference to `boost::re_detail::match_results_base ::m_free(void)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::re_detail::match_results_base ::gnu.linkonce.t.set_second(char const *, unsigned int, bool)+0x1a): undefined reference to `boost::re_detail::match_results_base > &, basic_string > 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 > &, basic_string > const &)' /tmp/ccCZxmp1.o: In function `basic_string ::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 *, char const *, boost::match_results &, boost::reg_expression const &, unsigned int, boost::re_detail::_priv_match_data &, char const * *)+0x77): undefined reference to `boost::re_detail::match_results_base ::set_first(char const *, unsigned int)' /tmp/ccCZxmp1.o: In function `basic_string ::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 *, char const *, boost::match_results &, boost::reg_expression const &, unsigned int)+0x34): undefined reference to `boost::re_detail::match_results_base ::m_free(void)' /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h(.boost::match_results ::gnu.linkonce.t.(allocator<char> const &)+0x14): undefined reference to `boost::re_detail::match_results_base
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