OpenCV 3.0视频错误

时间:2015-01-07 21:11:56

标签: c++ qt opencv

我尝试使用CMake 3.1.0为Qt Creator 5.4编译OpenCV 3.0 alpha库,但我有错误:

[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
_dshow.cpp.obj
D:\opencv\sources\modules\videoio\src\cap_dshow.cpp:122:11: error: base class 's
truct IUnknown' has accessible non-virtual destructor [-Werror=non-virtual-dtor]

 interface IEnumPIDMap : public IUnknown
           ^
D:\opencv\sources\modules\videoio\src\cap_dshow.cpp:141:11: error: base class 's
truct IUnknown' has accessible non-virtual destructor [-Werror=non-virtual-dtor]

 interface IMPEG2PIDMap : public IUnknown
           ^
D:\opencv\sources\modules\videoio\src\cap_dshow.cpp:231:11: error: base class 's
truct IUnknown' has accessible non-virtual destructor [-Werror=non-virtual-dtor]

 interface ISampleGrabberCB : public IUnknown
           ^
D:\opencv\sources\modules\videoio\src\cap_dshow.cpp:245:11: error: base class 's
truct IUnknown' has accessible non-virtual destructor [-Werror=non-virtual-dtor]

 interface ISampleGrabber : public IUnknown
           ^
cc1plus.exe: some warnings being treated as errors
modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:150: recipe for target
'modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj' failed
mingw32-make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dsho
w.cpp.obj] Error 1
CMakeFiles\Makefile2:2719: recipe for target 'modules/videoio/CMakeFiles/opencv_
videoio.dir/all' failed
mingw32-make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2

makefile:136: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

我选择了:

CMAKE --> CMAKE_BUILD_TYPE = Debug
WITH --> WITH_EIGEN = 0
WITH --> WITH_OPENGL = 0
WITH --> WITH_IPP = 0

其余设置是默认设置。我的操作系统是Windows 7 64位。 OpenCV库源:http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0-alpha/

有什么问题?有什么想法吗?

1 个答案:

答案 0 :(得分:33)

我在使用mingw在windows上编译opencv3.0.0时遇到了同样的问题。 我在link之后找到了一个解决方案。

进入opencv源所在的存储库。

对我而言,这是“C:/ opencv / sources /".

转到“Cmake /”文件夹并搜索名为“OpenCVCompilerOptions.cmake”的文件

您只需评论该行:

add_extra_compiler_option(-Werror=non-virtual-dtor)

所以它应该成为

#add_extra_compiler_option(-Werror=non-virtual-dtor)

现在,您可以使用cmake配置和生成makefile,mingw32-make命令行应该可以正常工作。