简体   繁体   English

Opencv + Boost:未定义的引用

[英]Opencv + Boost: Undefined references

I have a computer vision source code that is related to find copy and move portions in a forged image. 我有一个计算机视觉源代码,该源代码与查找和移动伪造图像中的部分有关。 I cannot compile this source code that uses openCV and Boost, some of the errors include undefined references to OpenCv stuff, for example:. 我无法编译使用openCV和Boost的源代码,其中一些错误包括对OpenCv内容的未定义引用,例如:。

main.cpp:(.text+0x3cc1): undefined reference to `cvSetZero'

My makefile is the following. 我的makefile如下。 I think I correctly indicate the boost and opencv libraries. 我想我正确地指出了boost和opencv库。 What could be wrong? 有什么事吗

# Boost library is required
BOOST_LIBS=-L/usr/include/boost -lboost_system  -lboost_random
BOOST_INCLUDE=-I/usr/include/boost
BOOST_VERSION=103500

OPENCV_INCLUDE=-I/usr/include/opencv2/ 
OPENCV_LIBS=-L/usr/include/opencv2/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_flann -lopencv_calib3d
OPENCV_LIBS=-L/usr/lib/opencv2/ -lopencv_core ...
                   ^^^

You might want to check if OpenCV is installed correctly and where this installation is located. 您可能要检查OpenCV是否正确安装以及该安装位置。 Afterwards you can adjust your makefile. 之后,您可以调整makefile。 How to do this depends on your OS. 如何执行此操作取决于您的操作系统。

Eg on Linux you might want to search for the opencv_core.so (eg via locate -b opencv_core ). 例如,在Linux上,您可能想搜索opencv_core.so (例如,通过locate -b opencv_core )。

In my case it would be 就我而言

OPENCV_LIBS=-L/usr/lib/ -lopencv_core

if you have pkg-config installed, and if it knows where OpenCV is, you can try 如果您已安装pkg-config ,并且知道OpenCV在哪里,则可以尝试

OPENCV_INCLUDE=$$(pkg-config --cflags opencv)
OPENCV_LIBS=$$(pkg-config --libs opencv)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM