QT opencv C++ Android编译问题 4C

最近想把windows下写好的opencv代码移植到Android平台上运行,于是搭建了一个QT for Android的编译环境,然后把代码放到QT里面编译。
刚开始用-Desktop_Qt_5_4_1_MinGW_32bit编译运行正常,可是把编译器换成Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_1之后就就报错,在网上查了好几天都没有找到解决方案。
有没有哪位大神知道的,帮帮忙,在下不胜感激!!

以下是关键的代码部分:

.pro文件:
INCLUDEPATH += E:\opencv\build\include\opencv2\
E:\opencv\build\include\opencv\
E:\opencv\build\include

LIBS += E:\opencv_cmake\lib\libopencv_core249.dll.a\
E:\opencv_cmake\lib\libopencv_highgui249.dll.a\
E:\opencv_cmake\lib\libopencv_imgproc249.dll.a\
E:\opencv_cmake\lib\libopencv_calib3d249.dll.a\
E:\opencv_cmake\lib\libopencv_contrib249.dll.a\
E:\opencv_cmake\lib\libopencv_features2d249.dll.a\
E:\opencv_cmake\lib\libopencv_flann249.dll.a\
E:\opencv_cmake\lib\libopencv_gpu249.dll.a\
E:\opencv_cmake\lib\libopencv_legacy249.dll.a\
E:\opencv_cmake\lib\libopencv_ml249.dll.a\
E:\opencv_cmake\lib\libopencv_objdetect249.dll.a\
E:\opencv_cmake\lib\libopencv_video249.dll.a

包含的opencv头文件:
#include
#include
#include

opencv代码部分
image = cv::imread("./1.jpg");
if(!image.data)
{
QMessageBox msgBox;
msgBox.setText(tr("image data is null"));
msgBox.exec();
}
else
{
cv::cvtColor(image,image,CV_BGR2RGB);
img = QImage((const unsigned char*)(image.data),image.cols,image.rows, image.cols*image.channels(), QImage::Format_RGB888);
ui->label->clear();
ui->label->setPixmap(QPixmap::fromImage(img));
//ui->processPushButton->setEnabled(true);
ui->label->resize(ui->label->pixmap()->size());
}

报错情况:
![图片说明](https://img-ask.csdn.net/upload/201607/28/1469671885_529743.png)
E:\opencv\build\include\opencv2\core\mat.hpp:278: error: undefined reference to `cv::fastFree(void*)'
E:\opencv\build\include\opencv2\core\mat.hpp:298: error: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
E:\opencv\build\include\opencv2\core\mat.hpp:367: error: undefined reference to `cv::Mat::deallocate()'
E:\QT_Work\build-testAndroid-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_1-Debug\mainwindow.obj:-1: In function `cv::Mat::operator=(cv::Mat const&)':
E:\QT_Work\build-testAndroid-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_1-Debug\mainwindow.obj:-1: In function `cv::Mat::release()':
E:\QT_Work\testAndroid\mainwindow.cpp:28: error: undefined reference to `cv::imread(std::string const&, int)'

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!