我正在使用 Visual Studio 2015 的 OpenCv 2.4.11 版本。当我尝试示例代码时,出现“应用程序无法正确启动 0xc00007b”错误。我的代码如下:
#include "stdafx.h"
#include <iostream>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main(int argc, char** argv) {
Mat img = imread("C:/Users/Murat/Desktop/lena1.png");
if (img.empty()) {
cout << "Resim yüklenemedi" << endl;
return -1;
}
namedWindow("deneme penecere ismi", CV_WINDOW_AUTOSIZE);
imshow("deneme penecere ismi", img);
waitKey(0);
destroyWindow("deneme penecere ismi");
return 0;
}
我该如何解决问题。
最佳答案
首先使用 Visual Studio 2015 编译器从源代码构建 OpenCV。这降低了旧框架从您的计算机中丢失的风险。您需要 vc14 目录作为库的来源。 Prebuilt libs 仅适用于 VS 2012 和 2013,它们是 opencv/build/x64 或 x86 下的 VC11 和 VC12 libs 文件夹。
步骤很简单。
- 下载 CMAKE,安装。
- 下载Opencv源码,解压。
- 运行 Cmake 并为项目添加源目录和目标目录。
- 配置 Cmake,首先选择正确的编译器 VS2015。有很多选择。先试试默认的。
- 运行 Cmake。结果是目标目录下的 Visual Studio 2015 项目,如 opencv.sln。
- 打开 opencv.sln 项目。
- 使用 Visual Studio 2015 构建此项目。
结果是包含要包含的库的 VC14 目录。
逐图查看此教程。 Tutorial Here
关于OpenCV-Visual Studio 2015,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33046722/