一旦我添加到我的代码
FlannBasedMatcher matcher;
构建
时出现以下错误g ++ -o“track”./track.o -lopencv_imgproc -lopencv_features2d -lopencv_nonfree -lopencv_core -lopencv_highgui -lopencv_video / usr / bin / ld:./ track.o:未定义的符号引用 '_ZN2cv5flann12SearchParamsC1Eifb' //usr/lib/x86_64-linux-gnu/libopencv_flann.so.2.4:添加错误 符号:命令行collect2中缺少DSO:错误:ld返回1 退出状态
任何想法?我正在运行Ubuntu
由于
答案 0 :(得分:1)
回答之前的问题(Strange linking error: DSO missing from command line)
您应该在对象后面的命令行中提到库 正在编译的文件
所以,在你的情况下:
nm -AD --defined-only / usr / lib64 / libopencv_ so。 | grep的 _ZN2cv5flann12SearchParamsC1Eifb /usr/lib64/libopencv_flann.so.2.4000000000000029650 T _ZN2cv5flann12SearchParamsC1Eifb /usr/lib64/libopencv_flann.so.2.4.9:00000000000000029650 T _ZN2cv5flann12SearchParamsC1Eifb
g ++ fbm.cc -o fbm -lopencv_flann -lopencv_imgproc -lopencv_features2d -lopencv_nonfree -lopencv_core -lopencv_highgui -lopencv_video
用于测试的代码示例:
#include <opencv2/features2d/features2d.hpp>
using namespace cv;
FlannBasedMatcher matcher;
int main()
{}