Compile OpenCV 3.1.0 under Visual Studio 2008
Contents
We can build OpenCV under Visual Studio by using CMake under Windows7. It is very easy to do this job using edition OpenCV 2.4.X with Visual Studio 2008.
But when I try to build OpenCV 3.1.0 under Visual Studio 2008, there are some errors!
The first error is :
Error 131 fatal error C1083: Cannot open include file: ‘stdint.h’: No such file or directory g:\setup_files\opencv\windows\opencv-3.1.0\sources\modules\imgcodecs\src\jpeg_exif.hpp 51
To fix this error, just google the stdint.h file and put it under the build path of OpenCV.
The second error is:
Error 1 error C2039: ‘data’ : is not a member of ‘std::vector<_Ty>’ g:\setup_files\OpenCV\Windows\OpenCV-3.1.0\sources\modules\videoio\src\cap_mjpeg_decoder.cpp 793
This error is generated by \modules\videoio\src∩_mjpeg_decoder.cpp line 793, the origin code is:
m_file_stream.read(result.data(), chunk.m_size);
To fix this error, just change the code into following:
m_file_stream.read(&result[0], chunk.m_size);
OpenCV 3.1.0 uses C++11 code but Visual Studio 2008 doesn’t support this feature.
By done these, re-compile your solution then you will get the OpenCV 3.1.0 libraries from Visual Studio 2008.
Author Watterry
LastMod 2016-01-06