I'm trying to deploy my C++ program. Every functionality of it works if I run the program from the VS IDE (release mode). When I ordinarily run the same executable, the main window comes up fine and its non-OpenCV functionality works; but when I try to open a picture and have the program use OpenCV stuff (opening it invokes the use of several OpenCV manipulations on the picture), it crashes.
I ran windeployqt
from the Developer Command Prompt for VS 2017 successfully. It didn't copy the OpenCV dlls next to my executable, though, so I copied opencv_world400.dll
and opencv_ffmpeg400_64.dll
next to the other dlls. I assume this is the step where I'm missing something. The folder looks like this now:
I'm using VS2017 with Qt5.10.1 and OpenCV4.0. I don't think I can insert relevant code as the project is quite big and it uses OpenCV functionality extensively.
I figured it out, the problem was unrelated to OpenCV ( opencv_world400.dll
was sufficient to copy into the folder).
The problem was: I used Qt's applicationDirPath()
, which returns the executable's path, to access a Results folder I was supposed to have previously created there, but did not. The program, if ran from VS, was accessing the existing Results folder in the Debug folder, even though I was running the program in release mode and applicationDirPath()
was returning the executable's path in the Release folder. When I was running the same executable ordinarily, it couldn't find the Results folder and crashed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.