gpt4 book ai didi

c++ - FlannBasedMatcher 匹配器构建

转载 作者:太空宇宙 更新时间:2023-11-04 10:46:03 26 4
gpt4 key购买 nike

一旦我添加到我的代码中

FlannBasedMatcher matcher;

构建时出现以下错误

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

有什么想法吗?我正在运行 Ubuntu

谢谢

最佳答案

先前问题的答案 ( Strange linking error: DSO missing from command line )

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

因此,在您的情况下:

  1. 找出 _ZN2cv5flann12SearchParamsC1Eifb(实际上是“cv::flann::SearchParams::SearchParams(int, float, bool)”)的定义位置:

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. 在引用后立即将 -lopencv_flann 添加到链接命令中:

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

关于c++ - FlannBasedMatcher 匹配器构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33070335/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com