I have installed boost in my mac using clang.
Include = /usr/local/include/boost-1_54/
Lib = /usr/local/lib/
( libboost_atomic-clang-darwin42-mt-1_54.a, libboost_math_c99f-clang-darwin42-mt-1_54.dylib)
and then I wanted to test if the installation is gone right or not. I try to compile a simple code which use boost::regex.
$$ clang++ -I /usr/local/include/boost-1_54/ -L /usr/local/lib/ -o regex test_regex.cpp
It gives error saying
Undefined symbols for architecture x86_64:
"boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)", referenced from:
boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int) in test_regex-qSWMLF.o
"boost::re_detail::get_mem_block()", referenced from:
boost::re_detail::perl_matcher<std::__1::__wrap_iter<char const*>, std::__1::allocator<boost::sub_match<std::__1::__wrap_iter<char const*> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::extend_stack() in test_regex-qSWMLF.o
boost::re_detail::save_state_init::save_state_init(boost::re_detail::saved_state**, boost::re_detail::saved_state**) in test_regex-qSWMLF.o
"boost::re_detail::put_mem_block(void*)", referenced from:
boost::re_detail::save_state_init::~save_state_init() in test_regex-qSWMLF.o
boost::re_detail::perl_matcher<std::__1::__wrap_iter<char const*>, std::__1::allocator<boost::sub_match<std::__1::__wrap_iter<char const*> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_extra_block(bool) in test_regex-qSWMLF.o
"boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail::perl_matcher<std::__1::__wrap_iter<char const*>, std::__1::allocator<boost::sub_match<std::__1::__wrap_iter<char const*> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_imp() in test_regex-qSWMLF.o
"boost::re_detail::raise_runtime_error(std::runtime_error const&)", referenced from:
void boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type) in test_regex-qSWMLF.o
"boost::re_detail::get_default_error_string(boost::regex_constants::error_type)", referenced from:
boost::re_detail::cpp_regex_traits_implementation<char>::error_string(boost::regex_constants::error_type) const in test_regex-qSWMLF.o
"boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const", referenced from:
boost::cpp_regex_traits<char>::transform_primary(char const*, char const*) const in test_regex-qSWMLF.o
"boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const", referenced from:
boost::cpp_regex_traits<char>::transform(char const*, char const*) const in test_regex-qSWMLF.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I remember using -libregex or something while using gcc to compile simple boost program. I have tried all combination but it still gives error saying ( by that I mean -libboost_regex-mt, libboost_atomic-clang-darwin42-mt-1_54.a , ..)
$$ clang++ -I /usr/local/include/boost-1_54/ -L /usr/local/lib/ -o regex test_regex.cpp -libboost_regex
ld: library not found for -libregex
Can anyone help how can I tell clang to use the proper library function to compile the test correctly?Please