Ambarish Mitra wrote:
Hi all,
I have the following code to validate a given url using boost::regex. The code is failing linking with g++ 3.3.2, but is building with 3.4.5
Any workaround, or pointer to help to build in 3.3.2? I am on boost 1.32. All the linking errors are related to std strings.
#include <iostream> #include <string> #include
// Boost.Regex lib using namespace std;
int main( ) { std::string url("http://myserver:80/index.html"); boost::regex re;
try { boost::regex re("(ftp|http|https):\/\/(\w+\.)*(\w*)\/([\w\d]+\/{0,1})+"); if (!boost::regex_match(url, re)) { throw "Your URL is not formatted correctly!"; } } catch (...) { cerr << "The regexp " << re << " is invalid!" << endl; } }
g++ regex2_url.cpp /usr/lib/libboost_regex.a
/usr/lib/libboost_regex.a(c_regex_traits.o)(.text+0xab2): In function `boost::re_detail::c_traits_base::set_message_catalogue(std::basic_string
const&)': undefined reference to `std::basic_string
Are you using a version of boost compiled with one gcc version and then trying to link with another different version? That might do it I guess. John.