OpenCV 2.3.0 编译错误之 file INSTALL cannot find opencv_ffmpeg230d.dll(无法找到opencv_ffmpeg230d.dll)

编译OpenCV2.3.0时,用VS2008打开D:\Program Files\OpenCV2.0\vc2008目录下生成OpenCV.sln

在Debug下,选择Solution Explorer里的 Solution OpenCV,点右键,运行"Rebuild Solution",编译无误。再选择INSTALL项目,运行"Build",报错,“CMake Error at cmake_install.cmake:119 (FILE): file INSTALL cannot find "D:/Program  Files/OpenCV-2.3.0/vs2008/bin/Debug/opencv_ffmpeg230d.dll.”

解决方法是找到文件search008/cmake_install.cmake, 将其中的与opencv_ffmpeg230d.dll有关的语句注释掉,如下:


#IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "main")
#  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE FILE FILES "D:/Program 
#Files/OpenCV-2.3.0/vs2008/bin/Debug/opencv_ffmpeg230d.dll")
#ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "main")


#IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "main")
#  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE FILE FILES "D:/Program 
#Files/OpenCV-2.3.0/vs2008/lib/Debug/opencv_ffmpeg230d.lib")
#ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "main")

之所以可以把这两行注释掉是因为项目中不存在opencv_ffmpeg230d对应的源文件,因此不会生成opencv_ffmpeg230d.dll 和lib文件,从官方给的superpack文件中也可以看出,没有opencv_ffmpeg230d.dll文件及lib文件。

后来发现2.3版本中的ffmpeg被放到了3rdparty文件夹中,这个与2.2版本的不同。2.3中的ffmpeg需要使用mingw下的gcc编译,而且有64位的版本,从ffmpeg文件夹中的make.bat可以看出:编译只是生成了opencv_ffmpeg.dll,并没有lib及其版本号,因此这是个瑕疵。

参考文章:http://www.360doc.com/content/11/0802/22/4539198_137542206.shtml#


你可能感兴趣的:(OpenCV)