I have issues linking yaml-cpp code. The weird thing is that it is compiler dependent. I am using homebrew to get yaml-cpp and gcc-4.8 . I have a simple program
#include <yaml-cpp/yaml.h>
int main(){
YAML::Node yparams_;
yparams = YAML::LoadFile("test.yaml");
printf("all good\n");
return 0;
}
It compiles and runs fine, if I use the 'g++' provided with mac
g++ test.cpp $(pkg-config --cflags --libs yaml-cpp) -o test
However, exchanging 'g++' to the homebrewed 'g++-4.8' gives me a long list of linker errors (attached below). If I run 'brew doctor' I do not get any warning. 'brew info yaml-cpp' returns with:
yaml-cpp: stable 0.5.1
http://code.google.com/p/yaml-cpp/
/usr/local/Cellar/yaml-cpp/0.5.1 (40 files, 1.0M) *
Built from source with: --c++11
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/yaml-cpp.rb
==> Dependencies
Build: cmake ✔
Required: boost ✔
The output of 'brew info gcc' is
gcc: stable 4.8.3 (bottled), HEAD
http://gcc.gnu.org
/usr/local/Cellar/gcc/4.8.3_1 (1046 files, 184M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/gcc.rb
==> Dependencies
Required: gmp ✔, libmpc ✔, mpfr ✔, cloog ✔, isl ✔
I appreciate any hint on how to fix this issue. Thanks!
"YAML::LoadFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
_main in ccG1oCNG.o
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<YAML::detail::node*, std::__1::allocator<YAML::detail::node*> >::__push_back_slow_path<YAML::detail::node*>(YAML::detail::node*&&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libyaml-cpp.a(node_data.cpp.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
YAML::Exception::Exception(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
YAML::BadSubscript::BadSubscript() in libyaml-cpp.a(node_data.cpp.o)
YAML::BadPushback::BadPushback() in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
YAML::Exception::Exception(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
boost::detail::shared_count::shared_count<YAML::detail::node_data>(YAML::detail::node_data*) in libyaml-cpp.a(memory.cpp.o)
boost::detail::sp_counted_impl_p<YAML::detail::node_data>::dispose() in libyaml-cpp.a(memory.cpp.o)
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
YAML::BadPushback::~BadPushback() in libyaml-cpp.a(node_data.cpp.o)
YAML::BadSubscript::~BadSubscript() in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
YAML::detail::node_data::set_tag(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
YAML::detail::node_data::set_scalar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
YAML::detail::node_ref::set_scalar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
YAML::Exception::build_what(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned long)", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
...
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::setbuf(char*, long)", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsgetn(char*, long)", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, long)", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::showmanyc()", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
YAML::Exception::build_what(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::~basic_streambuf()", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
...
"std::__1::ctype<char>::id", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::ios_base::init(void*)", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
YAML::Exception::build_what(YAML::Mark const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libyaml-cpp.a(node_data.cpp.o)
"std::__1::basic_ios<char, std::__1::char_traits<char> >::~basic_ios()", referenced from:
YAML::detail::node_data::convert_sequence_to_map(boost::shared_ptr<YAML::detail::memory_holder>) in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libyaml-cpp.a(node_data.cpp.o)
...
"typeinfo for std::__1::basic_istream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"typeinfo for std::__1::basic_ostream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"typeinfo for std::__1::basic_iostream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
typeinfo for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"typeinfo for std::__1::basic_streambuf<char, std::__1::char_traits<char> >", referenced from:
typeinfo for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libyaml-cpp.a(node_data.cpp.o)
Related
I've just downloaded this repo: UCTDom
And opening the project in Clion from the /UCTDom-master dir, or attempting to make from /UCTDom-master/Console4SimpleStorage/Console4SimpleStorage results in this missing architecture error:
Undefined symbols for architecture x86_64:
"BigMoneyAI::~BigMoneyAI()", referenced from:
Player::~Player() in main-cd1c38.o
"FlatUCBMod::~FlatUCBMod()", referenced from:
Player::~Player() in main-cd1c38.o
"HumanInputAI::~HumanInputAI()", referenced from:
Player::~Player() in main-cd1c38.o
"DoubleWitchAI::~DoubleWitchAI()", referenced from:
Player::~Player() in main-cd1c38.o
"SingleWitchAI::~SingleWitchAI()", referenced from:
Player::~Player() in main-cd1c38.o
"UCTMonteCarlo::~UCTMonteCarlo()", referenced from:
Player::~Player() in main-cd1c38.o
"Game::initialize()", referenced from:
playGame(Game&) in main-cd1c38.o
"Game::writeCSVLog(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
_main in main-cd1c38.o
"Game::writeToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
"Game::writeMoveHistoryToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
_main in main-cd1c38.o
"Game::play()", referenced from:
playGame(Game&) in main-cd1c38.o
"Game::Game()", referenced from:
_main in main-cd1c38.o
"FlatUCB::~FlatUCB()", referenced from:
Player::~Player() in main-cd1c38.o
"RandomAI::~RandomAI()", referenced from:
Player::~Player() in main-cd1c38.o
"GameState::~GameState()", referenced from:
Game::~Game() in main-cd1c38.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-cd1c38.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
Game::~Game() in main-cd1c38.o
Move::~Move() in main-cd1c38.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in main-cd1c38.o
"std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
_main in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::cin", referenced from:
_main in main-cd1c38.o
"std::__1::cout", referenced from:
playGame(Game&) in main-cd1c38.o
_main in main-cd1c38.o
"std::__1::ctype<char>::id", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in main-cd1c38.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in main-cd1c38.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in main-cd1c38.o
"std::__1::to_string(int)", referenced from:
_main in main-cd1c38.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
_main in main-cd1c38.o
"std::terminate()", referenced from:
___clang_call_terminate in main-cd1c38.o
"operator delete(void*)", referenced from:
_main in main-cd1c38.o
std::__1::_DeallocateCaller::__do_call(void*) in main-cd1c38.o
"operator new(unsigned long)", referenced from:
_main in main-cd1c38.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in main-cd1c38.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"___cxa_call_unexpected", referenced from:
std::__1::__vector_base<Move, std::__1::allocator<Move> >::__destruct_at_end(Move*) in main-cd1c38.o
std::__1::allocator<Move>::deallocate(Move*, unsigned long) in main-cd1c38.o
std::__1::__vector_base<LogItem, std::__1::allocator<LogItem> >::__destruct_at_end(LogItem*) in main-cd1c38.o
std::__1::allocator<LogItem>::deallocate(LogItem*, unsigned long) in main-cd1c38.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in main-cd1c38.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in main-cd1c38.o
"___gxx_personality_v0", referenced from:
writeToFile(Game&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in main-cd1c38.o
_main in main-cd1c38.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in main-cd1c38.o
Game::~Game() in main-cd1c38.o
std::__1::__vector_base<Move, std::__1::allocator<Move> >::__destruct_at_end(Move*) in main-cd1c38.o
std::__1::allocator<Move>::deallocate(Move*, unsigned long) in main-cd1c38.o
std::__1::__vector_base<LogItem, std::__1::allocator<LogItem> >::__destruct_at_end(LogItem*) in main-cd1c38.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main.o] Error 1
Process finished with exit code 2
I have figured out that perhaps the undefined deconstructors is an aspect of this, but it seems to me that this would have been a problem to the creators of the repo so I also figure that there is some simple file trick I have to do for the makefile in order to have it compile
for quick reference, heres the makefile:
CXX=g++
CXXFLAGS= -std=c++0x -Wall -pedantic
LDFLAGS=
SOURCES=main.cpp BigMoneyAI.cpp CardManager.cpp Game.cpp GameState.cpp HumanInputAI.cpp Move.cpp Node.cpp Player.cpp PlayerState.cpp UCTMonteCarlo.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=dominionuct
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
.cpp.o:
$(CC) $(CFLAGS) $< -o $#
I'm at a bit of a loss where to go with this, any help or tips to investigate would be much appreciated!
Thanks!
I am trying to run this example (from: https://theboostcpplibraries.com/boost.serialization-archive#ex.serialization_01):
#include <boost/archive/text_oarchive.hpp>
#include <iostream>
using namespace boost::archive;
int main()
{
text_oarchive oa{std::cout};
int i = 1;
oa << i;
}
With the command:
gcc -L"/usr/local/include/" test.cpp
And I am getting the following back:
Undefined symbols for architecture x86_64:
"boost::locale::base_message_format<char>::id", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
"boost::locale::details::format_parser::get_position()", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::set_one_flag(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::restore()", referenced from:
boost::locale::basic_format<char>::format_guard::restore() in test-e8c2b0.o
"boost::locale::details::format_parser::format_parser(std::__1::ios_base&, void*, void (*)(void*, std::__1::locale const&))", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::details::format_parser::~format_parser()", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"boost::locale::ios_info::display_flags(unsigned long long)", referenced from:
boost::locale::as::number(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::currency(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::date(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::time(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::strftime(std::__1::ios_base&) in test-e8c2b0.o
"boost::locale::ios_info::date_time_pattern_set()", referenced from:
void boost::locale::ios_info::date_time_pattern<char>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-e8c2b0.o
"boost::locale::ios_info::get(std::__1::ios_base&)", referenced from:
boost::locale::as::number(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::currency(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::date(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::as::time(std::__1::ios_base&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
void boost::locale::details::format_parser::set_flag_with_str<char>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-e8c2b0.o
boost::locale::as::strftime(std::__1::ios_base&) in test-e8c2b0.o
...
"boost::locale::converter<char>::id", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_upper<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_lower<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_title<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::fold_case<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
"boost::locale::generator::generator()", referenced from:
_main in test-e8c2b0.o
"boost::locale::generator::~generator()", referenced from:
_main in test-e8c2b0.o
"boost::locale::ios_info::domain_id() const", referenced from:
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
"boost::locale::generator::generate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
boost::locale::generator::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
void boost::locale::details::format_parser::set_flag_with_str<char>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-e8c2b0.o
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::__push_back_slow_path<boost::locale::details::formattible<char> const>(boost::locale::details::formattible<char> const&) in test-e8c2b0.o
"std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_upper<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_lower<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::to_title<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::locale::fold_case<char>(char const*, std::__1::locale const&) in test-e8c2b0.o
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
...
"std::__1::ios_base::getloc() const", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::logic_error::logic_error(char const*)", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"std::length_error::~length_error()", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
_main in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
boost::locale::basic_message<char>::str(std::__1::locale const&, int) const in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
boost::locale::details::string_cast_traits<char>::cast(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
boost::locale::details::string_cast_traits<char>::cast(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::~basic_format() in test-e8c2b0.o
boost::locale::basic_message<char>::~basic_message() in test-e8c2b0.o
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_message<char>::str(std::__1::locale const&, int) const in test-e8c2b0.o
boost::locale::basic_format<char>::format_output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in test-e8c2b0.o
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double)", referenced from:
_main in test-e8c2b0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(long)", referenced from:
_main in test-e8c2b0.o
void boost::locale::details::formattible<char>::write<long>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, void const*) in test-e8c2b0.o
"std::__1::cout", referenced from:
_main in test-e8c2b0.o
"std::__1::ctype<char>::id", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::locale::global(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
"std::__1::locale::locale(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::__1::locale::locale()", referenced from:
_main in test-e8c2b0.o
"std::__1::locale::~locale()", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::locale::operator=(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
"std::__1::ios_base::imbue(std::__1::locale const&)", referenced from:
_main in test-e8c2b0.o
boost::locale::basic_format<char>::imbue_locale(void*, std::__1::locale const&) in test-e8c2b0.o
"std::terminate()", referenced from:
___clang_call_terminate in test-e8c2b0.o
"typeinfo for std::length_error", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"typeinfo for char", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"vtable for std::length_error", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"operator delete[](void*)", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"operator delete(void*)", referenced from:
std::__1::__vector_base<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::~__vector_base() in test-e8c2b0.o
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::~__split_buffer() in test-e8c2b0.o
"operator new[](unsigned long)", referenced from:
void boost::locale::ios_info::string_set::set<char>(char const*) in test-e8c2b0.o
"operator new(unsigned long)", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_allocate_exception", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
boost::locale::basic_format<char>::format_guard::~format_guard() in test-e8c2b0.o
"___cxa_call_unexpected", referenced from:
boost::locale::basic_message<char>::write(std::__1::locale const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const in test-e8c2b0.o
void boost::locale::details::format_parser::set_flag_with_str<char>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-e8c2b0.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in test-e8c2b0.o
boost::locale::basic_format<char>::format_guard::~format_guard() in test-e8c2b0.o
"___cxa_free_exception", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___cxa_throw", referenced from:
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
"___gxx_personality_v0", referenced from:
_main in test-e8c2b0.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in test-e8c2b0.o
boost::locale::basic_format<char>::~basic_format() in test-e8c2b0.o
boost::locale::basic_message<char>::~basic_message() in test-e8c2b0.o
boost::locale::basic_format<char>::basic_format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in test-e8c2b0.o
void std::__1::vector<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> > >::__push_back_slow_path<boost::locale::details::formattible<char> const>(boost::locale::details::formattible<char> const&) in test-e8c2b0.o
std::__1::__split_buffer<boost::locale::details::formattible<char>, std::__1::allocator<boost::locale::details::formattible<char> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<boost::locale::details::formattible<char> >&) in test-e8c2b0.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Not sure why I am getting a clang error when I am using gcc and why there is an error with 86_64.
Edit: with adding the commands recommended by #walnut now I am getting:
Desktop $ gcc -L"/usr/local/include/" test.cpp -lboost_serialization -lboost_locale
ld: library not found for -lboost_serialization
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm beginning to learn how to use GTest to test a few Cpp and C libraries:
https://github.com/google/googletest
I'm trying out GTest on my macbook, with g++ version
$ g++ --version
g++ (Homebrew GCC 4.9.4_1) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
The installation appears successfully, e.g. after sudo make install:
...
-- Installing: /usr/local/lib/libgtest.a
-- Installing: /usr/local/lib/libgtest_main.a
...
I've been following this tutorial from a few months ago, https://www.youtube.com/watch?v=nbFXI9SDfbk
Here is the minimal working example:
#include <iostream>
#include <gtest/gtest.h>
using namespace std;
int main(int argc, char **argv){
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Here is how it's recommended to be compiled:
$ g++ Test.cpp -lgtest -lgtest_main -pthread
Above, the libraries are there, and this version of g++ should have -pthread capabilities built in. I get a massive linking error, for reasons I don't understand. Is there an obvious reason why the linking isn't working?
Here's the error, truncated for size:
$ g++ Test.cpp -lgtest -lgtest_main -pthread
/var/folders/1d/_h9qdvds6l5d7x78b21pn1_45n_16x/T//ccYIGdBL.s:7:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/1d/_h9qdvds6l5d7x78b21pn1_45n_16x/T//ccYIGdBL.s:7:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
testing::internal::EqFailure(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) in libgtest.a(gtest-all.cc.o)
testing::GetReservedAttributesForElement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestImpl::ConfigureXmlOutput() in libgtest.a(gtest-all.cc.o)
void testing::internal::ParseGoogleTestFlagsOnlyImpl<char>(int*, char**) in libgtest.a(gtest-all.cc.o)
void testing::internal::ParseGoogleTestFlagsOnlyImpl<wchar_t>(int*, wchar_t**) in libgtest.a(gtest-all.cc.o)
testing::internal::InDeathTestChild() in libgtest.a(gtest-all.cc.o)
testing::internal::DefaultDeathTestFactory::Create(char const*, testing::internal::RE const*, char const*, int, testing::internal::DeathTest**) in libgtest.a(gtest-all.cc.o)
...
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<testing::TestCase*, std::__1::allocator<testing::TestCase*> >::insert(std::__1::__wrap_iter<testing::TestCase* const*>, testing::TestCase* const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
void std::__1::vector<char*, std::__1::allocator<char*> >::__push_back_slow_path<char* const>(char* const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<char*, std::__1::allocator<char*> >::insert(std::__1::__wrap_iter<char* const*>, char* const&) in libgtest.a(gtest-all.cc.o)
void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__push_back_slow_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<double, std::__1::allocator<double> >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::vector<double, std::__1::allocator<double> >, std::__1::allocator<std::__1::vector<double, std::__1::allocator<double> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
...
"std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
std::__1::vector<testing::TestPartResult, std::__1::allocator<testing::TestPartResult> >::at(unsigned long) const in libgtest.a(gtest-all.cc.o)
std::__1::vector<testing::TestProperty, std::__1::allocator<testing::TestProperty> >::at(unsigned long) const in libgtest.a(gtest-all.cc.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPKcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_ in libgtest.a(gtest-all.cc.o)
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libgtest.a(gtest-all.cc.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libgtest.a(gtest-all.cc.o)
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libgtest.a(gtest-all.cc.o)
"std::logic_error::logic_error(char const*)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned long, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, unsigned long> > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::list<std::__1::pair<char, char const*>, std::__1::allocator<std::__1::pair<char, char const*> > >::push_back(std::__1::pair<char, char const*> const&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::__split_buffer<char*, std::__1::allocator<char*>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<char*>&) in libgtest.a(gtest-all.cc.o)
std::__1::__split_buffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) in libgtest.a(gtest-all.cc.o)
std::__1::vector<double, std::__1::allocator<double> >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
std::__1::vector<std::__1::vector<double, std::__1::allocator<double> >, std::__1::allocator<std::__1::vector<double, std::__1::allocator<double> > > >::allocate(unsigned long) in libgtest.a(gtest-all.cc.o)
...
"std::runtime_error::runtime_error(char const*)", referenced from:
testing::internal::GoogleTestFailureException::GoogleTestFailureException(testing::TestPartResult const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::erase(unsigned long, unsigned long)", referenced from:
testing::internal::StripTrailingSpaces(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
testing::internal::OutputFlagAlsoCheckEnvVar() in libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::RemoveDirectoryName() const in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetOutputFormat() in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetAbsolutePathToOutputFile() in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::FilterMatchesTest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::HasOneFailure(char const*, char const*, char const*, testing::TestPartResultArray const&, testing::TestPartResult::Type, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::String::ShowWideCString(wchar_t const*) in libgtest.a(gtest-all.cc.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
testing::internal::Indent(int) in libgtest.a(gtest-all.cc.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::AssertionResult::AppendMessage(testing::Message const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::FormatDeathTestOutput(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
testing::internal::UnitTestOptions::FilterMatchesTest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::RemoveFileName() const in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestImpl::RecordProperty(testing::TestProperty const&) in libgtest.a(gtest-all.cc.o)
testing::internal::FilePath::Normalize() in libgtest.a(gtest-all.cc.o)
testing::internal::CapturedStream::CapturedStream(int) in libgtest.a(gtest-all.cc.o)
bool testing::internal::ParseStringFlag<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libgtest.a(gtest-all.cc.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
testing::internal::StringStreamToString(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in libgtest.a(gtest-all.cc.o)
testing::internal::XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libgtest.a(gtest-all.cc.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libgtest.a(gtest-all.cc.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
testing::internal::AppendUserMessage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, testing::Message const&) in libgtest.a(gtest-all.cc.o)
testing::internal::UnitTestOptions::GetAbsolutePathToOutputFile() in libgtest.a(gtest-all.cc.o)
testing::internal::SingleFailureChecker::SingleFailureChecker(testing::TestPartResultArray const*, testing::TestPartResult::Type, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
testing::AssertionResult::AssertionResult(testing::AssertionResult const&) in libgtest.a(gtest-all.cc.o)
testing::internal::(anonymous namespace)::SplitEscapedString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libgtest.a(gtest-all.cc.o)
testing::TestInfo::TestInfo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*, char const*, testing::internal::CodeLocation, void const*, testing::internal::TestFactoryBase*) in libgtest.a(gtest-all.cc.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)", referenced from:
testing::internal::SplitString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libgtest.a(gtest-all.cc.o)
....
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libgtest.a(gtest-all.cc.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
#include <map>
#include <fstream>
#include <string>
#include <stdexcept>
using std::string;
using std::map;
using std::ifstream;
map<string, string> buildMap(ifstream &map_file)
{
map<string, string> trans_map;
string key;
string value;
while (map_file >> key && getline(map_file, value))
if (value.size() > 1)
trans_map[key] = value.substr(1);
else
throw runtime_error("no rule for " + key);
return trans_map;
}
int main()
{
return 0;
}
the error is
cppMapTest.cpp:19:19: error: use of undeclared identifier 'runtime_error'
throw runtime_error("no rule for " + key);
but when I add using std::runtime_error;,the error is
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::ios_base::getloc() const", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::runtime_error::~runtime_error()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::~pair() in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"std::__1::basic_istream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_istream<char, std::__1::char_traits<char> >&, bool)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::ctype<char>::id", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::locale::~locale()", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"std::terminate()", referenced from:
___clang_call_terminate in cppMapTest-1b8776.o
"typeinfo for std::runtime_error", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"operator delete(void*)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"operator new(unsigned long)", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"___cxa_allocate_exception", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___cxa_begin_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
___clang_call_terminate in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"___cxa_call_unexpected", referenced from:
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__find_equal_key(std::__1::__tree_node_base<void*>*&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::__construct_node_with_key(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
"___cxa_end_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.o
"___cxa_free_exception", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___cxa_throw", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
"___gxx_personality_v0", referenced from:
buildMap(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&) in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) in cppMapTest-1b8776.o
std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::operator[](std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in cppMapTest-1b8776.o
std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void*>*) in cppMapTest-1b8776.o
std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::~pair() in cppMapTest-1b8776.o
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) in cppMapTest-1b8776.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 programme on mac terminal with vim,compiler is clang-clang cppMapTest.cpp -o cppMapTest.exe
I want to know why,thank you.
You already figured out how to avoid the runtime_error error (using std::runtime_error;).
The linker errors can be fixed by compiling with clang++.
When compiling with clang, your compiler only links against the C libraries, not the C++ ones.
I installed VTK on my mac successfully using the following steps
How to install VTK 6.1 for OSX 10.8 with Cocoa/XCode support?
I'm trying to use VTK and I'm getting a long list of errors that I'm not sure if it has to do with VTK or with gcc ?
This is part of the error I'm getting
There are some errors that are similar to this
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_last_of(char const*, unsigned long, unsigned long) const", referenced from:
vtksys::SystemTools::GetFilenameName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
std::__1::vector<vtkStdString*, std::__1::allocator<vtkStdString*> >::at(unsigned long) in libvtkCommonCore-6.1.a(vtkAbstractArray.cxx.o)
std::__1::vector<std::__1::pair<bool, vtkStdString>, std::__1::allocator<std::__1::pair<bool, vtkStdString> > >::at(unsigned long) in libvtkCommonDataModel-6.1.a(vtkDataSetAttributes.cxx.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
...
"std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)
std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtksys-6.1.a(SystemTools.cxx.o)
std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkCommonSystem-6.1.a(vtkTimerLog.cxx.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonDataModel-6.1.a(vtkImageData.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonDataModel-6.1.a(vtkImageData.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkIOImage-6.1.a(vtkPNGWriter.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
...
"std::logic_error::logic_error(char const*)", referenced from:
vtkUnicodeString::at(unsigned long) const in libvtkCommonCore-6.1.a(vtkUnicodeString.cxx.o)
and some errors that are similar to this
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libvtksys-6.1.a(SystemTools.cxx.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
char vtkVariantStringToNumeric<char>(vtkStdString, bool*, char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
float vtkVariantStringToNumeric<float>(vtkStdString, bool*, float*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
double vtkVariantStringToNumeric<double>(vtkStdString, bool*, double*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
unsigned char vtkVariantStringToNumeric<unsigned char>(vtkStdString, bool*, unsigned char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
signed char vtkVariantStringToNumeric<signed char>(vtkStdString, bool*, signed char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
short vtkVariantStringToNumeric<short>(vtkStdString, bool*, short*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
unsigned short vtkVariantStringToNumeric<unsigned short>(vtkStdString, bool*, unsigned short*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)
vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:
vtkOStrStreamWrapper::vtkOStrStreamWrapper() in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
vtkExecutive::CheckAlgorithm(char const*, vtkInformation*) in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)
vtkGarbageCollectorImpl::PrintComponent(vtkGarbageCollectorImpl::ComponentType*) in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
vtkGarbageCollectorImpl::Report(vtkObjectBase*, void*, char const*) in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
vtkVariant::ToString() const in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
vtkStdString vtkVariantArrayToString<vtkArrayIteratorTemplate<double> >(vtkArrayIteratorTemplate<double>*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
"std::__1::cout", referenced from:
vtkPolyhedron::vtkInternal::ExtractContourConnectivities(vtkIdToIdVectorMapType&, std::__1::set<long long, std::__1::less<long long>, std::__1::allocator<long long> >&, std::__1::vector<long long, std::__1::allocator<long long> >&, vtkIdToIdVectorMapType&, vtkIdToIdVectorMapType&, vtkIdToIdVectorMapType&) in libvtkCommonDataModel-6.1.a(vtkPolyhedron.cxx.o)
"void std::__1::__sort<std::__1::__less<signed char, signed char>&, signed char*>(signed char*, signed char*, std::__1::__less<signed char, signed char>&)", referenced from:
vtkSortDataArray::Sort(vtkAbstractArray*) in libvtkCommonCore-6.1.a(vtkSortDataArray.cxx.o)
"typeinfo for std::__1::basic_istream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_istringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
>::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
...
"_crc32", referenced from:
_vtk_png_reset_crc in libvtkpng-6.1.a(png.c.o)
_vtk_png_calculate_crc in libvtkpng-6.1.a(png.c.o)
"_deflate", referenced from:
_vtk_png_write_flush in libvtkpng-6.1.a(pngwrite.c.o)
_png_text_compress in libvtkpng-6.1.a(pngwutil.c.o)
_vtk_png_write_finish_row in libvtkpng-6.1.a(pngwutil.c.o)
_vtk_png_write_filtered_row in libvtkpng-6.1.a(pngwutil.c.o)
"_deflateEnd", referenced from:
_vtk_png_write_destroy in libvtkpng-6.1.a(pngwrite.c.o)
"_deflateInit2_", referenced from:
_vtk_png_write_IHDR in libvtkpng-6.1.a(pngwutil.c.o)
"_deflateReset", referenced from:
_png_write_compressed_data_out in libvtkpng-6.1.a(pngwutil.c.o)
_vtk_png_write_finish_row in libvtkpng-6.1.a(pngwutil.c.o)
"_inflateReset", referenced from:
_vtk_png_reset_zstream in libvtkpng-6.1.a(png.c.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [myCode] Error 1
Any tips would be helpful
It turns out I had to add the following two libraries -lc++ -lz. I found the answer in the following two links:
crc32() missing when building libzip on OSX 10.9
STD linker error with Apple LLVM 4.1