1
votes

I'm trying to compile using a compiled Boost libs. I can compile using header-only Boost libraries, but now that I want to use libraries that needs to be compiled, I can't get it to work. I built the whole Boost library using toolset=gcc and --build-type=complete stage. I'm using Eclipse and I'm linking the folder at where the libs are located at: project_properties->c/c++ build->settings->mingw c++ linker->libraries and at the library search path (-L) I'm linking the folder path. I'm getting errors like:

undefined reference to `boost::regex_error::raise() const'

or

undefined reference to `boost::re_detail::lookup_default_collate_name(std::string const&)'

I'm compiling an example-code from the boost tutorial setup guide which includes boost/regex.hpp

2

2 Answers

1
votes

You need to link your program to Boost precompiled library.

Example:

c++ -I path/to/boost_1_48_0 example.cpp -o example \
 -L~/boost/stage/lib/ -lboost_regex-gcc34-mt-d-1_36

See description here

0
votes

Eclipse: project properties -> c++ build -> settings -> linker -> libraries

Add boost_regex to Libraries if you want to use shared library or :/usr/lib/libboost_regex.a (or wherever libboost_regex.a is) if you want static linking.