Когда я пытаюсь запустить код в режиме отладки, все работает нормально, но когда я пытаюсь запустить его в режиме выпуска, я получаю ошибку "file_name! = Nullptr" (ошибка исходит от fopen).Я знаю, что означает ошибка, но я не знаю, почему я получаю ошибку и как ее исправить
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
String imageName("C:/Users/x/Desktop/pic.png"); // by default
if (argc > 1)
{
imageName = argv[1];
}
Mat image;
image = imread(imageName, IMREAD_COLOR); // Read the file
if (image.empty()) // 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;
}
Сообщение об ошибке:
>-----------Microsoft Visual C++ Runtime Library----------------
>
>
>Debug Assertion Assertion Faild!
>
>Programm: C:\Users\x\...\myProgramm.exe
>File: minkernel\crts\ucrt\src\appcrt\stdio\fopen.cpp
>
>Line: 30
>
>Expression: file_name != nullptr