使用mingw链接静态库(a)到exe
Link static libs (.a) into exe with mingw
我目前正在尝试使用OpenCV,但我遇到了一点麻烦。我使用qt ide和mingw来编译我的应用程序。
我的代码是这样的:
#include “highgui.h”
int main( int argc, char** argv )
{
IplImage* img1 = cvLoadImage( argv[1] );
cvNamedWindow( “Example”, CV_WINDOW_AUTOSIZE );
cvShowImage( “Example”, img1 );
cvWaitKey(0);
cvReleaseImage( &img1 );
cvDestroyWindow( “Example” );
return(0);
}
在我的。pro文件中:
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/"
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/opencv/"
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/opencv2/"
LIBS += -L"E:/OpenCV2MinGWBuild/install/lib/" -lopencv_calib3d231.dll -lopencv_contrib231.dll -lopencv_core231.dll
库是.a-s(dll在库的名称部分,它不是扩展名)。我知道。a库是linux特有的,但是mingw应该能够使用它们,对吗?
我用mingw构建了OpenCV库,但我不能让它们链接到我的Qt应用程序。MinGW可以很好地看到头文件,但看不到库。我总是得到"对cvShowImage'", "undefined reference to
cvNamedWindow'的未定义引用"(等)错误…
任何帮助都是感激的!非常感谢!
dll。a不是静态库文件,它们是动态链接.dll
的存根-您需要重新构建OpenCv以使用静态库.lib
并将其直接链接到您的代码
相关文章:
- 执行用 C++ 编写的.exe(使用 mingw 编译器)时出现问题
- mingw-w64 ... ld.exe: cannot find -lboost_filesystem
- MinGW编译的exe-缺少libgcc_s_silj-1.dll
- Mingw 64艘没有Make.exe的船
- 将文本注释添加到exe文件mingw
- MinGW在代码块中构建时的ar.exe "could not create temporary file whilst writing archive: no more archived files
- 如何在 Atom IDE 中使用 gpp-compiler 时更改 MinGW 编译的 exe 位置?
- COM exe, C++, and MinGW
- MinGW .exe 需要一些 gcc dll 的,不管代码是什么?
- MinGW/Eclipse ld.exe找不到库
- 使用mingw链接静态库(a)到exe
- C++ Eclipse Mars+MinGW 中的调试器"gdb.exe --version"错误
- 可以在没有Visual Studio的情况下使用MinGw编译python.exe
- Mingw产生破碎的.exe
- MinGW GCC.exe正在从路径中删除所有
- MinGW产生exe,当在不同的系统上运行时会产生"not compatible with the version of Windows"
- 启动 MinGW 编译的 exe 时缺少 libgcc_s_dw2-1.dll 错误
- 使用 MinGW-Build 在 64 位系统上编译 32 位 exe -- 编译 32 位 exe,但链接到 64 位
- 安装MinGW的gdb.exe用于代码块
- 如何使用Microsoft Visual C++调试器调试MinGW EXE