1 | initial version |
I have finally figured it out. Michael Burdnov's comment about the runtime dll's that it loads pointed my in the right direction. How I solved it:
In the project properties, I noticed that the debug version had the Runtime Library set to Multi-threaded Debug DLL (/MDd), while the release version had Multi-threaded DLL (/MD). (you can find this setting under "Configuration Properties" --> "C/C++" --> "Code Generation")
If I set the release version to the same Runtime Library, it works! Only question remaining of course, is why. But for now, at least I can build an optimised version of my code, with a load of debug code (which I had put in a #ifdef _DEBUG construction) gone from the build.
Thank you all for your help!
I have finally figured it out. Michael Burdnov's comment about the runtime dll's that it loads pointed my me in the right direction.
How I solved it:
In the project properties, I noticed that the debug version had the Runtime Library set to Multi-threaded Debug DLL (/MDd), while the release version had Multi-threaded DLL (/MD). (you can find this setting under "Configuration Properties" --> "C/C++" --> "Code Generation")
If I set the release version to the same Runtime Library, it works! Only question remaining of course, is why. But for now, at least I can build an optimised version of my code, with a load of debug code (which I had put in a #ifdef _DEBUG construction) gone from the build.
Thank you all for your help!
3 | Replaced wrong answer with the final correct one. |
I have finally figured it out. Michael Burdnov's comment about the runtime dll's that it loads pointed me in the right direction.
How I solved it:out.
In the project properties, my configuration under Linker, I noticed that the debug version had the Runtime have added Additional Library set to Multi-threaded Debug DLL (/MDd), while the release version had Multi-threaded DLL (/MD).
(you can find this setting under "Configuration Properties" --> "C/C++" --> "Code Generation")Dependencies:
opencv_core242d.lib
opencv_imgproc242d.lib
opencv_highgui242d.lib
opencv_ml242d.lib
opencv_video242d.lib
opencv_features2d242d.lib
opencv_calib3d242d.lib
opencv_objdetect242d.lib
opencv_contrib242d.lib
opencv_legacy242d.lib
opencv_flann242d.lib
If I set It took me a while to notice that they all end with "*d.lib" and that there might be a chance that this d means "debug". Removing the d in all these files for the release version to the same Runtime Library, it works! Only question remaining of course, is why. But for now, at least I can build an optimised version of my code, with a load of debug code (which I had put in a #ifdef _DEBUG construction) gone from the build.solved it!
Thank you all for your help!