[英]link error- Qt Creator OpenCV Ubuntu
I am currently having a link error with Qt. 我目前在Qt上出现链接错误。 I cant compile my code since i got the error message:
由于收到错误消息,因此无法编译代码:
error: undefined reference to `cv::imread(cv::String const&, int)'
Heres the content of my .pro 这是我的.pro的内容
QT += core
QT -= gui
TARGET = edge_detection
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
Heres my simple code: 这是我的简单代码:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
int main(){
cv::Mat img;
img=cv::imread("/home/cgross/Downloads/2.jpg");
return 0;
}
I am not sure of where is the problem 我不确定问题出在哪里
includepath must show opencv and opencv2.just like that: includepath必须像这样显示opencv和opencv2。
INCLUDEPATH += C:\\opencv-2.4.6.1\\build-msvc2012\\install\\include
LIBS+=-LC:\\opencv-2.4.6.1\\build-msvc2012\\install\\lib \
-lopencv_calib3d246d \
-lopencv_contrib246d \
-lopencv_core246d \
-lopencv_features2d246d \
-lopencv_flann246d \
lıbs must show .lib file 文件必须显示.lib文件
Your code builds and runs just fine for me on a somewhat antique stock ubuntu 12.10 with opencv 2.3 from the distribution packages. 您的代码可以在分发包中带有opencv 2.3的老式古董ubuntu 12.10上构建并正常运行。
It picks up a cv::imread(std::string const &, int) from libopencv_highgui. 它从libopencv_highgui中获取一个cv :: imread(std :: string const&,int)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.