Posts tagged as ' Visual Studio ' ...

Posted By Tommy

Compiling OpenCV 2.0 with Visual Studio 2010

I had a couple of troubles setting up OpenCV 2.0 in Microsoft Visual Studio 2010. I simply updated the working build from VS 2008. It had been working fine. So the first thing I found out that there was an error with “std::back_inserter”. The problem is that it was part of the standard package, but now it’s not. This trouble affects two files: “cvmodelest.ccp” and cvhog.cpp” so it’s easily cured by adding 

#include <iterator> 

to cv.h. somewhere around line 60.

Another problem I encountered was a crash with videoInput.lib. It seems that it’s been compiled with VS2005 and it’s source code is not included. So with a bit of research I found that it’s not exactly a necessary thing to include anyway, so I followed the instructions:

http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=9199

# On Windows: enabling the VideoInput library:

The libvideoInput.a library file provided by Willow Garage was built with the old SJLJ exception handling method. Therefore, you cannot link against it using compilers that use the new DWARF-2 exception handling method like MinGW 4.4.x, unless you rebuild the libvideoInput.a file using MinGW. The best bet for compilers using DWARF-2 is not to use VideoInput at all. This can be done by taking the following step:

1. Comment the line containing “#define HAVE_VIDEOINPUT 1″ (i.e. near line 101 or 105), in file src/highgui/_highgui.h.

In contrast, for old compilers using SJLJ like TDM, to have VideoInput included in OpenCV 2.0:

1. Edit file src/highgui/CMakeLists.txt
2. At line 199, insert ” ole32 oleaut32 uuid” at the end of the list of libraries to be linked against (i.e. after “videoInput strmiids”). The developers have forgotten to insert them.