我正在尝试构建启用了 FFMPEG 的 OpenCV 2.3.0。由于 Ubuntu 11.10 仅提供 0.7 版的 libavcodec/format,而票证 #1020(下面的链接)表明它应该适用于 0.8。
如果我尝试编译,我会收到以下错误:
[ 18%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o
In file included from /home/chris/src/OpenCV-2.3.0/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/foo/src/OpenCV-2.3.0/modules/highgui/src/cap_ffmpeg_impl.hpp:103:36: fatal error: libavformat/avformat.h: No such file or directory
compilation terminated.
此文件位于 /opt/linux64-debug/include/ffmpeg/libavformat/avformat.h
。我尝试使用 CMAKE_INCLUDE_{DIRECTORY,PATH}、CMAKE_PREFIX_PATH 和 CMAKE_LIBRARY_PATH 指向 make。这些都没有用。 (我总是使用路径 /opt/linux64-debug/include/ffmpeg
。)
最佳答案
试试 include_directories()
命令。在我的 CMakeLists.txt 文件中,我这样使用它:
include_directories(. /opt/special/headers/in/here)
add_executable(helloworld helloworld.c)
我从来没有遇到过任何问题。
关于build - 将 CMake 项目指向特定的包含文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7766460/