Reputation: 1762
I am getting the following errors:
//usr/local/lib/libsmfitting.so: undefined reference to `VO_FaceParts::VO_GetOneFacePart(unsigned int) const'
//usr/local/lib/libsmfitting.so: undefined reference to `cv::estimateRigidTransform(cv::_InputArray const&, cv::_InputArray const&, bool)'
collect2: error: ld returned 1 exit status
Being produced from this makefile:
Cxx=g++
CXXFLAGS = -I/usr/local/include/opencv -I/usr/local/include/opencv2 -I/usr/local/include/vosm/smfitting -I/usr/local/include/vosm/smbuilding -I/usr/local/include/vosm/comalgs -I/usr/local/include/vosm/cvcommon -I/usr/local/include/vosm/ensembletraining -I/usr/local/include/vosm/featureextraction -I/usr/local/include/vosm/integraltransform -I/usr/local/include/vosm/utils
LIBS = -lopencv_ml -lopencv_calib3d -lopencv_legacy -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_video -lopencv_objdetect -lcomalgs -lcvcommon -lensembletraining -lfeatureextraction -lintegraltransform -lsmbuilding -lutils -lboost_system -lboost_filesystem -lsmfitting
all: faceApp.cpp
$(Cxx) -o faceApp faceApp.cpp $(CXXFLAGS) $(LIBS)
The code appears to be correct and the libraries appear to be built correctly, I believe the error lies in the makefile.
Upvotes: 0
Views: 242
Reputation: 409136
The order of the libraries when linking is significant, and should be in reverse dependency order. So if library B depends on library A, then you need to put B before A when linking.
In your case it seems that the smfitting
library depends on one of the OpenCV libraries, as well as some other library, so you need to put it before those libraries.
Upvotes: 3