I used macports to download and install boost lib without any problems.
I tried to run the code from their website and got the following novel:
c++ -c -o Main.o Main.cpp
Compiling...
g++ -o VectorSjov Main.o utunity/math/vector/Vec2d.cpp
Undefined symbols for architecture x86_64:
"boost::serialization::void_upcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void const*)", referenced from:
bus_stop* boost::archive::detail::load_pointer_type<boost::archive::text_iarchive>::pointer_tweak<bus_stop>(boost::serialization::extended_type_info const&, void const*, bus_stop const&)in Main.o
bus_route* boost::archive::detail::load_pointer_type<boost::archive::text_iarchive>::pointer_tweak<bus_route>(boost::serialization::extended_type_info const&, void const*, bus_route const&)in Main.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)", referenced from:
boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_corner>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_route>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::extended_type_info_typeid()in Main.o
...
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from:
boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_destination>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_corner>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_route>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::~extended_type_info_typeid()in Main.o
...
"boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)", referenced from:
boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_corner>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_route>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::extended_type_info_typeid()in Main.o
...
"boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_destination>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
boost::serialization::extended_type_info_typeid<bus_stop>::~extended_type_info_typeid()in Main.o
...
"boost::serialization::void_downcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void const*)", referenced from:
void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
"boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::serialization::collection_size_type>(boost::serialization::collection_size_type&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in Main.o
void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::serialization::collection_size_type>(boost::serialization::collection_size_type const&)in Main.o
...
"boost::archive::archive_exception::~archive_exception()", referenced from:
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in Main.o
void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::serialization::collection_size_type>(boost::serialization::collection_size_type&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in Main.o
void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in Main.o
void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
...
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load_override(boost::archive::class_name_type&, int)", referenced from:
boost::archive::text_iarchive& boost::archive::detail::interface_iarchive<boost::archive::text_iarchive>::operator>><boost::archive::class_name_type>(boost::archive::class_name_type&)in Main.o
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)", referenced from:
void boost::archive::load_access::load_primitive<boost::archive::text_iarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_iarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)in Main.o
"boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::text_iarchive_impl(std::basic_istream<char, std::char_traits<char> >&, unsigned int)", referenced from:
boost::archive::text_iarchive::text_iarchive(std::basic_istream<char, std::char_traits<char> >&, unsigned int)in Main.o
"boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Main.o
....
bus_stop_corner>in Main.o
typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, bus_route>in Main.o
typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, bus_schedule::trip_info>in Main.o
...
"typeinfo for boost::archive::detail::basic_pointer_iserializer", referenced from:
typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_route>in Main.o
typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_stop_destination>in Main.o
typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_stop_corner>in Main.o
"typeinfo for boost::archive::detail::basic_pointer_oserializer", referenced from:
typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_route>in Main.o
typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_stop_destination>in Main.o
typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_stop_corner>in Main.o
"vtable for boost::archive::archive_exception", referenced from:
boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)in Main.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [VectorSjov] Error 1
[Finished in 3.1s with exit code 2]
SERIOUSLY? :D
Don't forget to link to boost serialization, it's not header-only library.
> Undefined symbols for architecture x86_64
Try compile with different options: -m32 or -m64
Related
I'm trying to use boost::regex_search in my application. Compiling with g++ 8.3 version gives me a symbol referencing error as below
boost::re_detail_106600::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)
std::string url = "A4B3CD";
boost::regex exp("4");
boost::smatch match;
if (boost::regex_search(url, match, exp))
P.S :: When the same is compiled with g++ 8.5 it works fine.
Machine details : Red Hat Enterprise Linux release 8.6
Today I experimented with GCC/G++ :(
I was not sure which c++ standards were installed (completely new to c++), so I updated gcc to the latest version with brew (brew install gcc --HEAD) but now it seems that the latest version is unfortunately unstable for my setup.
clang version before: Apple clang version 12.0.0 (clang-1200.0.32.27)
clang version after: Apple clang version 12.0.0 (clang-1200.0.32.27) but with following error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OS: macOS#11.0.1
Does anyone knows how to solve this? I am still able to use g++, only gcc is not working at all, no matter of -std= flag or not. Is installing the latest stable version a proper solution or will this make it worse ;-) ?
gcc helloworld.cc -v -o out
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name helloworld.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.0 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609.6 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdeprecated-macro -fdebug-compilation-dir "/Users/user/x/y/z/zz/zzz" -ferror-limit 19 -fmessage-length 167 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.0.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -x c++ helloworld.cc
clang -cc1 version 12.0.0 (clang-1200.0.32.27) default target x86_64-apple-darwin20.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o out -L/usr/local/lib /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"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 helloworld-3e60f0.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.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 helloworld-3e60f0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", 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 helloworld-3e60f0.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 helloworld-3e60f0.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 helloworld-3e60f0.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 helloworld-3e60f0.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 helloworld-3e60f0.o
"std::__1::cout", referenced from:
_main in helloworld-3e60f0.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 helloworld-3e60f0.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.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 helloworld-3e60f0.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in helloworld-3e60f0.o
"std::terminate()", referenced from:
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_begin_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 helloworld-3e60f0.o
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_call_unexpected", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.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 helloworld-3e60f0.o
"___gxx_personality_v0", 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 helloworld-3e60f0.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 helloworld-3e60f0.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
Dwarf Exception Unwind Info (__eh_frame) in helloworld-3e60f0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You cannot compile C++ code with gcc or clang. You need to use a C++ compiler, such as clang++ or g++.
Check what you are actually running. If you use gcc file.c, at least run:
type gcc
to se what you are running. If it's /bin/something or /usr/bin/something or /Applications/something, it's from Apple. If it's /usr/local/something it's homebrew.
If you are using homebrew, firstly check you are doing everything right by running:
brew doctor
And secondly, make sure your PATH starts with /usr/local/bin which is where homebrew puts its binaries:
export PATH=/usr/local/bin:$PATH
i'm trying to do an iterative closest point but since I'm a noob I'm trying starting from this tutorial:
http://pointclouds.org/documentation/tutorials/iterative_closest_point.php
all required dependencies are installed, Operative System is MacOs High Sierra, I have this error when I execute make command :
Undefined symbols for architecture x86_64:
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::__1::vector<int, std::__1::allocator<int> > const> const&)", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.o
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::radiusSearch(pcl::PointXYZ const&, double, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<float, std::__1::allocator<float> >&, unsigned int) const", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.o
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::nearestKSearch(pcl::PointXYZ const&, int, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<float, std::__1::allocator<float> >&) const", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.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[2]: *** [iterative_closest_point] Error 1
make[1]: *** [CMakeFiles/iterative_closest_point.dir/all] Error 2
make: *** [all] Error 2
I can not understand what I'm wrong
I'm trying to install openscad, I have install all dependencies but when i'm trying to make openscad i've got this problem:
$ make
clang++ -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -stdlib=libc++ -arch x86_64 -o OpenSCAD.app/Contents/MacOS/OpenSCAD objects/OffscreenContextCGL.o objects/CocoaUtils.o objects/PlatformUtils-mac.o objects/scintillaeditor.o objects/scadlexer.o objects/version_check.o objects/ProgressWidget.o objects/mathc99.o objects/linalg.o objects/Camera.o objects/handle_dep.o objects/value.o objects/expr.o objects/stackcheck.o objects/func.o objects/localscope.o objects/module.o objects/feature.o objects/node.o objects/context.o objects/modcontext.o objects/evalcontext.o objects/csgnode.o objects/CSGTreeNormalizer.o objects/CSGTreeEvaluator.o objects/Geometry.o objects/Polygon2d.o objects/clipper-utils.o objects/polyset-utils.o objects/GeometryUtils.o objects/polyset.o objects/polyset-gl.o objects/csgops.o objects/transform.o objects/color.o objects/primitives.o objects/projection.o objects/cgaladv.o objects/surface.o objects/control.o objects/render.o objects/text.o objects/dxfdata.o objects/dxfdim.o objects/offset.o objects/linearextrude.o objects/rotateextrude.o objects/printutils.o objects/fileutils.o objects/progress.o objects/parsersettings.o objects/stl-utils.o objects/boost-utils.o objects/PlatformUtils.o objects/LibraryInfo.o objects/nodedumper.o objects/traverser.o objects/GeometryEvaluator.o objects/ModuleCache.o objects/GeometryCache.o objects/Tree.o objects/DrawingCallback.o objects/FreetypeRenderer.o objects/FontCache.o objects/settings.o objects/rendersettings.o objects/highlighter.o objects/Preferences.o objects/OpenCSGWarningDialog.o objects/editor.o objects/GLView.o objects/QGLView.o objects/AutoUpdater.o objects/grid.o objects/builtin.o objects/calc.o objects/export.o objects/export_stl.o objects/export_amf.o objects/export_off.o objects/export_dxf.o objects/export_svg.o objects/export_nef.o objects/export_png.o objects/import.o objects/renderer.o objects/colormap.o objects/ThrownTogetherRenderer.o objects/svg.o objects/OffscreenView.o objects/fbo.o objects/system-gl.o objects/imageutils.o objects/lodepng.o objects/openscad.o objects/mainwin.o objects/UIUtils.o objects/Dock.o objects/FontListDialog.o objects/FontListTableView.o objects/launchingscreen.o objects/legacyeditor.o objects/LibraryInfoDialog.o objects/clipper.o objects/bucketalloc.o objects/dict.o objects/geom.o objects/mesh.o objects/priorityq.o objects/sweep.o objects/tess.o objects/imageutils-macosx.o objects/OpenCSGRenderer.o objects/cgalutils.o objects/cgalutils-applyops.o objects/cgalutils-project.o objects/cgalutils-tess.o objects/cgalutils-polyhedron.o objects/CGALCache.o objects/CGALRenderer.o objects/CGAL_Nef_polyhedron.o objects/cgalworker.o objects/Polygon2d-CGAL.o objects/AppleEvents.o objects/moc_scintillaeditor.o objects/moc_ProgressWidget.o objects/moc_QGLView.o objects/moc_MainWindow.o objects/moc_Preferences.o objects/moc_OpenCSGWarningDialog.o objects/moc_AboutDialog.o objects/moc_FontListDialog.o objects/moc_FontListTableView.o objects/moc_highlighter.o objects/moc_editor.o objects/moc_Dock.o objects/moc_AutoUpdater.o objects/moc_launchingscreen.o objects/moc_legacyeditor.o objects/moc_LibraryInfoDialog.o objects/moc_cgalworker.o objects/moc_EventFilter.o objects/qrc_openscad.o objects/parser_yacc.o objects/lexer_lex.o -F/usr/local/Cellar/qt/4.8.7_2/lib -L/opt/local/lib -L/usr/local/Cellar/qt/4.8.7_2/lib -framework Cocoa -framework ApplicationServices -lCGAL -lmpfr -lgmp -lopencsg -lGLEW -lboost_thread-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -L/usr/local/Cellar/glib/2.46.2/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl -liconv -L/usr/local/lib -lharfbuzz -L/usr/local/Cellar/freetype/2.6_1/lib -L/usr/local/Cellar/fontconfig/2.11.1/lib -lfontconfig -lfreetype -L/usr/local/Cellar/qt/4.8.7_2/lib -lqscintilla2 -framework QtOpenGL -L/usr/local/opt/openssl/lib -F/usr/local/Cellar/qt/4.8.7_2/lib -framework QtGui -framework QtCore -framework OpenGL -framework AGL
ld: warning: object file (objects/OffscreenContextCGL.o) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (objects/CocoaUtils.o) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (objects/PlatformUtils-mac.o) was built for newer OSX version (10.10) than being linked (10.7)
Undefined symbols for architecture x86_64:
"boost::re_detail_106000::get_mem_block()", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_all_states() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_startmark() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_alt() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_rep() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_char_repeat() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_set_repeat() in Tree.o
...
"boost::re_detail_106000::put_mem_block(void*)", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::unwind_extra_block(bool) in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in import.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::unwind_extra_block(bool) in import.o
"boost::re_detail_106000::verify_options(unsigned int, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in import.o
"boost::re_detail_106000::raise_runtime_error(std::runtime_error const&)", referenced from:
void boost::re_detail_106000::raise_error > > >(boost::regex_traits_wrapper > > const&, boost::regex_constants::error_type) in Tree.o
void boost::re_detail_106000::raise_error > > >(boost::regex_traits_wrapper > > const&, boost::regex_constants::error_type) in import.o
"boost::re_detail_106000::get_default_error_string(boost::regex_constants::error_type)", referenced from:
boost::re_detail_106000::cpp_regex_traits_implementation::error_string(boost::regex_constants::error_type) const in Tree.o
boost::re_detail_106000::cpp_regex_traits_implementation::error_string(boost::regex_constants::error_type) const in import.o
"boost::re_detail_106000::cpp_regex_traits_implementation::transform_primary(char const*, char const*) const", referenced from:
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in Tree.o
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in import.o
"boost::re_detail_106000::cpp_regex_traits_implementation::transform(char const*, char const*) const", referenced from:
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in Tree.o
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in import.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: *** [OpenSCAD.app/Contents/MacOS/OpenSCAD] Error 1
Looking at the linker flags, it looks like you might have two different version of Boost installed. Mixing packages from different package managing frameworks makes such issues hard to track down. It could of course be a case of just needing "make clean", but hard to see from only the linker line.
I would recommend using the official build instructions to manage dependencies - those are pretty well maintained on OS X: https://github.com/openscad/openscad#building-for-mac-os-x
Here is my simple test code,
#include <iostream>
int main(){
std::cout << "SAO" << std::endl;
return 0;
}
and compile command below
gcc -o test test.cpp
and I am having a compile error below.
Undefined symbols for architecture x86_64:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned long) const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced from:
_main in ccMFcxIz.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccMFcxIz.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in ccMFcxIz.o
"std::cout", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in ccMFcxIz.o
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in ccMFcxIz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I've tried putting -m32 just in case but still give me error below.
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Version of gcc is 4.2 which is installed by XCode "command line tool".
OS is Mac OSX Mountain Lion.
I've tried with gcc 4.7 or clang 3.1 but same error..
Ofcourse, compiling cpp code with gcc will give you error. You should use g++