我在Linux ubuntu 16.04上使用Qt 5.12.2,执行程序时出现错误消息
找不到/usr/local/lib/libopencv_highgui.so需要的libQtOpenGL.so.4(尝试使用-rpath或-rpath-link)
找不到/usr/local/lib/libopencv_highgui.so需要的libQtTest.so.4(尝试使用-rpath或-rpath-link)
对`cv :: imread(std :: __ cxx11 :: basic_string,std :: allocator> const&,int)的未定义引用'
对`cv :: namedWindow(std :: __ cxx11 :: basic_string,std :: allocator> const&,int)的未定义引用'
对`cv :: _ InputArray :: _ InputArray(cv :: Mat const&)的未定义引用
对`cv :: imshow(std :: __ cxx11 :: basic_string,std :: allocator> const&,cv :: _ InputArray const&)的未定义引用
collect2:错误:ld返回1个退出状态
你们知道如何解决这个问题吗?
我正在使用的代码是一个波纹管
open_image.pro
QT += core
QT -= gui
TARGET = OpenCV-Ex1
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
CONFIG += link_pkgconfig
PKGCONFIG += opencv
main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
int main() {
//Le a imagem
cv::Mat image;
image = cv::imread("len_std.png",0);
//Mostra a imagem na janela
cv::namedWindow("Imagem Original"); // define a janela
cv::imshow("Imagem Original", image);
//Mostra o tamanho da imagem
std::cout << "Tamanho: " << image.size().height << "x" << image.size().width << std::endl;
cv::waitKey(0);
return 0;
}