Building an OpenCV application with Visual Studio 2008 and running it from another computer

无人久伴 提交于 2019-12-11 12:13:07

问题


I've made a simple OpenCV application with Visual Studio 2008 and I've built it in both release mode and debug mode.It works fine from my computer but when I try to run it from another computer which doesn't have OpenCV installed or has another version of Visual Studio with OpenCV it doesn't work.

How can I make the app work from a computer which doesn't have either Visual Studio or OpenCV installed ?

I'm thinking to add the external dependencies ( lib's and dll's ) into the app's folder, change the path in Visual Studio and rebuild it.

Thanks in advance and sorry for the ultranoobish question :)


回答1:


You don't need to distribute the libs; those are just needed for building the executable.
Just copy the dlls somewhere where the executable can see them (either in the same dir as the exe, or in a dir that's on the system path) and you should be golden.




回答2:


Copying DLL's with the application or to the path is a good start, but may not be enough. It took me a long time to find out why OpenCV application didn't work on another machine. Visual Studio runtime and OpenMP are used by OpenCV. Those are not installed by default and error messages, if any, are not all that helpful.

You need to build OpenCV and your application with setting (in Visual Studio): Configuration Properties -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded (/MT) You need to disable OpenMP support too if that's the problem. Build system changed with OpenCV 2.0. If I remember right, older version had different project files for version without OpenMP.



来源:https://stackoverflow.com/questions/2539980/building-an-opencv-application-with-visual-studio-2008-and-running-it-from-anoth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!