尝试使用OpenCV库运行示例代码后,进程以退出代码-1073741515(0xC0000135)完成 [英] Process finished with exit code -1073741515 (0xC0000135) after trying to run sample code using OpenCV library
本文介绍了尝试使用OpenCV库运行示例代码后,进程以退出代码-1073741515(0xC0000135)完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图在 Windows 下使用 CLion IDE 运行 OpenCV .当我尝试运行此示例代码以加载和显示图像
I've been trying to run OpenCV using CLion IDE under Windows. When I try to run this sample code for loading and displaying an image
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
if( argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread("earth.jpg", CV_LOAD_IMAGE_COLOR); // Read the file
if(! image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
我得到了错误声明:
进程结束,退出代码为-1073741515(0xC0000135)
Process finished with exit code -1073741515 (0xC0000135)
关于我的 CMakeLists.txt 中的内容,看起来像这样:
As for the content in my CMakeLists.txt, it looks like this:
cmake_minimum_required(VERSION 3.6)
project(test)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Where to find CMake modules and OpenCV
set(OpenCV_DIR "C:\\opencv\\mingw-build\\install")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(openCV main.cpp)
# add libs you need
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
# linking
target_link_libraries(openCV ${OpenCV_LIBS})
感谢您的帮助.
推荐答案
在CLion启动之前,需要将带有DLL的OpenCV二进制路径添加到您的路径中. 我是从脚本执行的:
You need to add OpenCV binary path with DLLs to your PATH BEFORE CLion start. I do it from script:
=== CLionWithMingwAndOpenCV.bat ==========================
@echo off
set PATH=C:\mingw-w64\x86_64-5.2.0-win32-seh-rt_v4-rev0\mingw64\bin;D:\opencv\release\bin;%PATH%
"C:\Program Files (x86)\JetBrains\CLion XXXX\bin\clion64.exe"
=== ==========================
这篇关于尝试使用OpenCV库运行示例代码后,进程以退出代码-1073741515(0xC0000135)完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文