linking to boost regex in gcc

Posted by rboorgapally on Stack Overflow See other posts from Stack Overflow or by rboorgapally
Published on 2009-02-17T23:21:08Z Indexed on 2010/03/27 14:13 UTC
Read the original article Hit count: 582

Filed under:
|
|
|
|

i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four files

boost_regex-gcc-1_35
boost_regex-gcc-d-1_35
libboost_regex-gcc-1_35.a
libboost_regex-gcc-d-1_35.a

Now I want to use regex from my program which is in some arbitrary directory. I #included boost/regex.hpp

I got the error which stated that regex.hpp is not found. Then I gave the -I option in the g++ compiler. I didn't get that error. But I get the following error

undefined reference to `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, 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)'

I googled and found that I need to somehow link one of the above 4 libraries to my program. How can I do it. Which one should I link and why?

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost