MinGW:使用opencv构建动态库

时间:2013-12-19 12:03:17

标签: c++ opencv mingw

想要构建一个显示图像的简单dll:

#include <opencv2\core\core.hpp>
#include<opencv2\highgui\highgui.hpp>

using namespace cv;

void showimagedata(uchar * dataBuffer,int width,int height)
{
    Mat image(Size(width, height), CV_8UC1, dataBuffer, Mat::AUTO_STEP);
    imshow("image",image);
}

如何使用MinGW编译它?

我尝试了以下内容:

g++ -c -fPIC showimg.cpp -o showimg.o -I"C:\opencv\build-mingw\install\include" -L"C:\opencv\build-mingw\install\x86\mingw\lib" -lopencv_core247 -lopencv_highgui247
g++ -shared -Wl,-soname,libshowimg.so.1 -o libshowimg.so.1.0.1  showimg.o

但似乎链接器无法找到符号。

文件名和路径是正确的,但我不确定命名约定。 这两个库名为:libopencv_core247.dll.a libopencv_highgui247.dll.a

0 个答案:

没有答案