FlannBasedMatcher匹配器建设

时间:2015-10-11 21:33:35

标签: c++ linux opencv

一旦我添加到我的代码

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

由于

1 个答案:

答案 0 :(得分:1)

回答之前的问题(Strange linking error: DSO missing from command line

  

您应该在对象后面的命令行中提到库   正在编译的文件

所以,在你的情况下:

  1. 找出_ZN2cv5flann12SearchParamsC1Eifb(实际上" cv :: flann :: SearchParams :: SearchParams(int,float,bool)")的定义:
  2.   

    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

    1. 在引用后立即将-lopencv_flann添加到链接命令:
    2.   

      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()
      {}