我最近添加了-pedantic和-pedantic-errors給我的gcc編譯選項來幫助清理我的跨平臺代碼。一切都很好,直到它在外部包含的頭文件中發現錯誤。有沒有辦法關閉這個錯誤在外部頭檢查文件IE:如何忽略外部庫頭中的gcc編譯器迂迴錯誤?
保持檢查的文件包括如下:
#include "myheader.h"
停止檢查包含文件是這樣的:
#include <externalheader.h>
這裏是我得到的錯誤:
g++ -Wall -Wextra -Wno-long-long -Wno-unused-parameter -pedantic --pedantic-errors
-O3 -D_FILE_OFFSET_BITS=64 -DMINGW -I"freetype/include" -I"jpeg" -I"lpng128" -I"zlib"
-I"mysql/include" -I"ffmpeg/libswscale" -I"ffmpeg/libavformat" -I"ffmpeg/libavcodec"
-I"ffmpeg/libavutil" -o omingwd/kguimovie.o -c kguimovie.cpp
In file included from ffmpeg/libavutil/avutil.h:41,
from ffmpeg/libavcodec/avcodec.h:30,
from kguimovie.cpp:44:
ffmpeg/libavutil/mathematics.h:32: error: comma at end of enumerator list
In file included from ffmpeg/libavcodec/avcodec.h:30,
from kguimovie.cpp:44:
ffmpeg/libavutil/avutil.h:110: error: comma at end of enumerator list
In file included from kguimovie.cpp:44:
ffmpeg/libavcodec/avcodec.h:277: error: comma at end of enumerator list
ffmpeg/libavcodec/avcodec.h:303: error: comma at end of enumerator list
ffmpeg/libavcodec/avcodec.h:334: error: comma at end of enumerator list
ffmpeg/libavcodec/avcodec.h:345: error: comma at end of enumerator list
ffmpeg/libavcodec/avcodec.h:2249: warning: `ImgReSampleContext' is deprecated
(declared at ffmpeg/libavcodec/avcodec.h:2243)
ffmpeg/libavcodec/avcodec.h:2259: warning: `ImgReSampleContext' is deprecated
(declared at ffmpeg/libavcodec/avcodec.h:2243)
In file included from kguimovie.cpp:45:
ffmpeg/libavformat/avformat.h:262: error: comma at end of enumerator list
In file included from ffmpeg/libavformat/rtsp.h:26,
from ffmpeg/libavformat/avformat.h:465,
from kguimovie.cpp:45:
ffmpeg/libavformat/rtspcodes.h:38: error: comma at end of enumerator list
In file included from ffmpeg/libavformat/avformat.h:465,
from kguimovie.cpp:45:
ffmpeg/libavformat/rtsp.h:32: error: comma at end of enumerator list
ffmpeg/libavformat/rtsp.h:69: error: comma at end of enumerator list
這實際上並沒有回答這個問題。 – Nick 2009-03-19 17:00:52
@KPexEA:請考慮重新分配接受的明顯更好的答案 - 幫助SO搜索結果和人類讀者發現答案。 – sehe 2011-11-03 23:29:27