2012-03-03 84 views
2

我想用cmake編譯OpenCV,但我不斷收到以下錯誤。如何在Linux下編譯OpenCV 11.04

[ 73%] Building CXX object src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o 
In file included from /usr/include/libavutil/avutil.h:81:0, 
from /usr/include/libavcodec/avcodec.h:30, 
from /usr/include/libavformat/avformat.h:56, 
from /vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:97: 
/usr/include/libavutil/common.h: In function ‘int32_t av_clipl_int32(int64_t)’: 
/usr/include/libavutil/common.h:154:47: error: ‘UINT64_C’ was not declared in this scope 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp: In  member function ‘virtual bool CvCapture_FFMPEG::grabFrame()’: 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:546:9: warning: ‘int avcodec_decode_video(AVCodecContext*, AVFrame*, int*, const uint8_t*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3452) 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:548:54:  warning: ‘int avcodec_decode_video(AVCodecContext*, AVFrame*, int*, const uint8_t*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3452) 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp: In member function ‘virtual bool CvVideoWriter_FFMPEG::open(const char*, int, double, CvSize, bool)’: 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:1199:8: warning: ‘AVOutputFormat* guess_format(const char*, const char*, const char*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:787) 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:1199:41: warning: ‘AVOutputFormat* guess_format(const char*, const char*, const char*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:787) 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:1213:7: warning: ‘AVFormatContext* av_alloc_format_context()’ is deprecated (declared at /usr/include/libavformat/avformat.h:947) 
/vol/cruk/Packages/irtk_ubuntu1104/vdm108/OpenCV200w/src/highgui/cvcap_ffmpeg.cpp:1213:31: warning: ‘AVFormatContext* av_alloc_format_context()’ is deprecated (declared at /usr/include/libavformat/avformat.h:947) 
make[2]: *** [src/highgui/CMakeFiles/highgui.dir/cvcap_ffmpeg.o] Error 1 
make[1]: *** [src/highgui/CMakeFiles/highgui.dir/all] Error 2 
make: *** [all] Error 2 

我不知道爲什麼它這樣做。我真的很感激任何建議。

回答

2

我假設你用C++編譯器編譯它。如果你這樣做,你應該定義一個__STDC_CONSTANT_MACROS標誌來使整個事情順利編譯。

更多信息:FFMPEG FAQ