|
Boost Users : |
Subject: [Boost-users] boost_regex compiler error
From: Chris Padwick (chris.padwick_at_[hidden])
Date: 2016-12-05 12:47:31
Hi - I am stuck on a linker error with the boost_regex library. My
platform is ubuntu 16.04 LTS, arm64, NVIDIA TX1. I downloaded and built
boost 1.62.0 with the following parameters:
./bootstrap.sh --prefix=/usr/local
sudo ./b2 -d2 architecture=arm address-model=64 install
I compiled a simple program using this command line:
g++ main.cpp -I/usr/local/include -L/usr/local/lib -lboost_regex
Here is the program:
#include <boost/regex.hpp>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
static const boost::regex rxInt("[0-9]+");
string word = "foobar";
if(boost::regex_match(word, rxInt)) {
cout << "Integer" << endl;
} else {
cout << "Not integer" << endl;
}
return 0;
}
Here are the linker errors:
/tmp/ccuOD7Zj.o: In function `bool
boost::regex_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
boost::match_results<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > > >&, boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags)':
main.cpp:(.text._ZN5boost11regex_matchIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SJ_RNS_13match_resultsISJ_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsE[_ZN5boost11regex_matchIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SJ_RNS_13match_resultsISJ_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsE]+0x58):
undefined reference to
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >::match()'
/tmp/ccuOD7Zj.o: In function
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char,
boost::cpp_regex_traits<char> >
>::perl_matcher(__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
boost::match_results<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > > >&, boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char
const*, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >)':
main.cpp:(.text._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEC2ESC_SC_RNS_13match_resultsISC_SF_EERKNS_11basic_regexIcSJ_EENS_15regex_constants12_match_flagsESC_[_ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEC5ESC_SC_RNS_13match_resultsISC_SF_EERKNS_11basic_regexIcSJ_EENS_15regex_constants12_match_flagsESC_]+0xf8):
undefined reference to
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > >,
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, boost::regex_traits<char,
boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags)'
collect2: error: ld returned 1 exit status
Any hints would be appreciated. Should I try to use an earlier version of
boost?
thank you!
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net