Apple Mach-O Linker (Id) Error (Active Shape Model) (SOLVED)

Hello guys,

I am starting to use ASM (Active Shape Model) in order to detect faces features, landmarks and different things by using OpenCV. I think I have a very elemental problem by linking libraries but I really don’t know what’s the problem, I would really appreciate if you could tell me any advice. I am using Mac OS Yosemite 10.10.1 and Xcode 6.1.1. I download the source code from here (https://code.google.com/p/asmlib-opencv/source/browse/) and when I try to compile main.cpp I get this error:

Ld build/Debug/MoreTest normal x86_64
cd /Users/Kerry/Downloads/test_opencv/MoreTest
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/Kerry/Downloads/test_opencv/MoreTest/build/Debug -L/usr/local/lib -L/Users/Kerry/Desktop/MUCT/trunk/src/lib -L/Users/Kerry/Desktop/MUCT/trunk/src/build/lib -L/Users/Kerry/Desktop/MUCT/trunk/src/build/lib/CMakeFiles/asm.dir -L/Users/Kerry/Desktop/MUCT/trunk/src/build/lib/CMakeFiles -F/Users/Kerry/Downloads/test_opencv/MoreTest/build/Debug -F/Users/Kerry/Downloads/opencv-2.4.9 -filelist /Users/Kerry/Downloads/test_opencv/MoreTest/build/MoreTest.build/Debug/MoreTest.build/Objects-normal/x86_64/MoreTest.LinkFileList -mmacosx-version-min=10.10 -stdlib=libc++ -lopencv_objdetect -lopencv_photo -lopencv_video -lopencv_calib3d -lopencv_core -lopencv_imgproc -lopencv_features2d -lopencv_highgui -Xlinker -dependency_info -Xlinker /Users/Kerry/Downloads/test_opencv/MoreTest/build/MoreTest.build/Debug/MoreTest.build/Objects-normal/x86_64/MoreTest_dependency_info.dat -o /Users/Kerry/Downloads/test_opencv/MoreTest/build/Debug/MoreTest

Undefined symbols for architecture x86_64:
“StatModel::ShapeModel::viewShapeModel()”, referenced from:
_main in main.o
“StatModel::ShapeModel::ShapeModel()”, referenced from:
StatModel::ASMModel::ASMModel() in main.o
“StatModel::ASMModel::buildModel(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
buildASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o
“StatModel::ASMModel::saveToFile(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
buildASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o
“StatModel::ASMModel::showResult(cv::Mat&, std::__1::vector<StatModel::ASMFitResult, std::__1::allocatorStatModel::ASMFitResult > const&)”, referenced from:
searchAndFit(StatModel::ASMModel&, cv::CascadeClassifier&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) in main.o
asmOnWebCam(StatModel::ASMModel&, cv::CascadeClassifier&, int) in main.o
“StatModel::ASMModel::loadFromFile(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
readASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o
“StatModel::ASMModel::fitAll(cv::Mat const&, std::_1::vector<cv::Rect, std::_1::allocator<cv::Rect > > const&, int)”, referenced from:
searchAndFit(StatModel::ASMModel&, cv::CascadeClassifier&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) in main.o
asmOnWebCam(StatModel::ASMModel&, cv::CascadeClassifier&, int) in main.o
“vtable for StatModel::ShapeModel”, referenced from:
StatModel::ShapeModel::~ShapeModel() in main.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
“vtable for StatModel::ASMModel”, referenced from:
StatModel::ASMModel::~ASMModel() in main.o
StatModel::ASMModel::ASMModel() 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
clang: error: linker command failed with exit code 1 (use -v to see invocation)

“StatModel::ShapeModel::viewShapeModel()”, referenced from:
_main in main.o

“StatModel::ShapeModel::ShapeModel()”, referenced from:
StatModel::ASMModel::ASMModel() in main.o

“StatModel::ASMModel::buildModel(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
buildASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o

“StatModel::ASMModel::saveToFile(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
buildASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o

“StatModel::ASMModel::showResult(cv::Mat&, std::__1::vector<StatModel::ASMFitResult, std::__1::allocatorStatModel::ASMFitResult > const&)”, referenced from:
searchAndFit(StatModel::ASMModel&, cv::CascadeClassifier&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) in main.o

  asmOnWebCam(StatModel::ASMModel&, cv::CascadeClassifier&, int) in main.o

“StatModel::ASMModel::loadFromFile(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)”, referenced from:
readASMModel(StatModel::ASMModel&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.o

“StatModel::ASMModel::fitAll(cv::Mat const&, std::_1::vector<cv::Rect, std::_1::allocator<cv::Rect > > const&, int)”, referenced from:
searchAndFit(StatModel::ASMModel&, cv::CascadeClassifier&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) in main.o

  asmOnWebCam(StatModel::ASMModel&, cv::CascadeClassifier&, int) in main.o

“vtable for StatModel::ShapeModel”, referenced from:
StatModel::ShapeModel::~ShapeModel() in main.o

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

“vtable for StatModel::ASMModel”, referenced from:
StatModel::ASMModel::~ASMModel() in main.o

  StatModel::ASMModel::ASMModel() 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

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thank you so much in advance!!

As I said before, a very elemental and stupid mistake… sorry for the inconvenience guys, it’s already solved!! :slight_smile: Thank you very much!!

Hi I am really new to mac and I am a little confused and having some linker problems in Xcode (c++)… I am using npp2 repository and I am trying to compile an example but I got a lot of errors. What could be the problem ? please any help appreciated. I am showing some of the errors.

Undefined symbols for architecture x86_64:
“NPP2::PatternSet::load_pattern(std::string const&)”, referenced from:
main in trainnet.o
“NPP2::Net::saveNet(std::string const&) const”, referenced from:
main in trainnet.o
“std::1::vector_base_common::_throwlength_error() const”, referenced from:
std::1::vector1::allocator >::__append(unsigned long) in libnpp2.a(npp2.o)
void std::1::vector1::allocator >::_pushback_slow_path(int const&) in libnpp2.a(npp2.o)
std::1::vector1::allocator >::allocate(unsigned long) in libnpp2.a(npp2.o)
std::1::vector1::allocator >::__append(unsigned long, NPP2::BasicLayerType* const&) in libnpp2.a(npp2.o)
void std::1::vector1::allocator >::_pushback_slow_path(AbstractRegistry::Entry const&) in libnpp2.a(Registry.o)
“std::1::locale::has_facet(std::1::locale::id&) const”, referenced from:
std::1::basic_filebuf1::char_traits >::basic_filebuf() in libnpp2.a(PatternSet.o)
std::1::basic_filebuf1::char_traits >::basic_filebuf() in libnpp2.a(npp2.o)
“std::1::locale::use_facet(std::1::locale::id&) const”, referenced from:
std::1::basic_ostream1::char_traits >& std::1::endl1::char_traits >(std::1::basic_ostream1::char_traits >&) in libnpp2.a(PatternSet.o)
std::1::basic_filebuf1::char_traits >::imbue(std::__1::locale const&) in libnpp2.a(PatternSet.o)
std::1::basic_filebuf1::char_traits >::basic_filebuf() in libnpp2.a(PatternSet.o)
std::1::basic_ostream1::char_traits >& std::1::put_character_sequence1::char_traits >(std::1::basic_ostream_1::chartraits >&, char const*, unsigned long) in libnpp2.a(PatternSet.o)
NPP2::Net::loadNet(std::1::basic_istream1::char_traits >&) in libnpp2.a(npp2.o)
std::1::basic_ostream1::char_traits >& std::1::endl1::char_traits >(std::1::basic_ostream1::char_traits >&) in libnpp2.a(npp2.o)
std::1::basic_istream1::char_traits >& std::1::operator>>1::char_traits, std::1::allocator >(std::1::basic_istream1::char_traits >&, std::1::basic_string1::char_traits, std::1::allocator >&) in libnpp2.a(npp2.o)

“std::_1::iosbase::getloc() const”, referenced from:
std::1::basic_ostream1::char_traits >& std::1::endl1::char_traits >(std::1::basic_ostream1::char_traits >&) in libnpp2.a(PatternSet.o)
std::1::basic_ostream1::char_traits >& std::1::put_character_sequence1::char_traits >(std::1::basic_ostream_1::chartraits >&, char const*, unsigned long) in libnpp2.a(PatternSet.o)
NPP2::Net::loadNet(std::1::basic_istream1::char_traits >&) in libnpp2.a(npp2.o)
std::1::basic_ostream1::char_traits >& std::1::endl1::char_traits >(std::1::basic_ostream1::char_traits >&) in libnpp2.a(npp2.o)
std::1::basic_istream1::char_traits >& std::1::operator>>1::char_traits, std::1::allocator >(std::1::basic_istream1::char_traits >&, std::1::basic_string1::char_traits, std::1::allocator >&) in libnpp2.a(npp2.o)
std::1::basic_ostream1::char_traits >& std::1::put_character_sequence1::char_traits >(std::1::basic_ostream_1::chartraits >&, char const*, unsigned long) in libnpp2.a(npp2.o)
std::1::basic_ostream1::char_traits >& std::1::endl1::char_traits >(std::1::basic_ostream1::char_traits >&) in libnpp2.a(FullyConnectedLayer.o)

“std::1::basic_string1::char_traits, std::1::allocator >::init(char const*, unsigned long)”, referenced from:
NPP2::Net::createLayers(int, int*, int) in libnpp2.a(npp2.o)
NPP2::Net::createLayers(std::1::vector1::allocator > const&, int, bool) in libnpp2.a(npp2.o)
NPP2::Net::loadNet(std::1::basic_istream1::char_traits >&) in libnpp2.a(npp2.o)
NPP2::Net::saveNet(std::1::basic_string1::char_traits, std::__1::allocator > const&) const in libnpp2.a(npp2.o)
NPP2::Net::loadNet(std::1::basic_string1::char_traits, std::__1::allocator > const&) in libnpp2.a(npp2.o)
NPP2::NPPException::NPPException(std::1::basic_string1::char_traits, std::__1::allocator > const&) in libnpp2.a(NPPException.o)
layerfactoryFullyConnectedLayer::layerfactoryFullyConnectedLayer() in libnpp2.a(FullyConnectedLayer.o)

“std::1::basic_string1::char_traits, std::1::allocator >::init(char const*, unsigned long, unsigned long)”, referenced from:
std::1::basic_string1::char_traits, std::1::allocator > std::1::operator+1::char_traits, std::1::allocator >(std::1::basic_string1::char_traits, std::1::allocator > const&, std::1::basic_string1::char_traits, std::1::allocator > const&) in libnpp2.a(NPPException.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only