Giu_ai
Giu_ai

Reputation: 183

FlannBasedMatcher matcher building

as soon as i add to my code

FlannBasedMatcher matcher;

i get the following error when building

g++ -o "track" ./track.o -lopencv_imgproc -lopencv_features2d -lopencv_nonfree -lopencv_core -lopencv_highgui -lopencv_video /usr/bin/ld: ./track.o: undefined reference to symbol '_ZN2cv5flann12SearchParamsC1Eifb' //usr/lib/x86_64-linux-gnu/libopencv_flann.so.2.4: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

any idea? I am running Ubuntu

Thanks

Upvotes: 0

Views: 448

Answers (1)

y_ug
y_ug

Reputation: 1124

Answer from an earlier question (Strange linking error: DSO missing from command line)

You should mention the library on the command line after the object files being compiled

So, in your case:

  1. Find out where _ZN2cv5flann12SearchParamsC1Eifb (actually "cv::flann::SearchParams::SearchParams(int, float, bool)") is defined:

nm -AD --defined-only /usr/lib64/libopencv_so. | grep _ZN2cv5flann12SearchParamsC1Eifb /usr/lib64/libopencv_flann.so.2.4:0000000000029650 T _ZN2cv5flann12SearchParamsC1Eifb /usr/lib64/libopencv_flann.so.2.4.9:0000000000029650 T _ZN2cv5flann12SearchParamsC1Eifb

  1. add -lopencv_flann to the link command immediately after it was referenced:

g++ fbm.cc -o fbm -lopencv_flann -lopencv_imgproc -lopencv_features2d -lopencv_nonfree -lopencv_core -lopencv_highgui -lopencv_video

Code sample for testing:

#include <opencv2/features2d/features2d.hpp>

using namespace cv;
FlannBasedMatcher matcher;

int main()
{}

Upvotes: 1

Related Questions