嗨,我正在使用xcode编译ffmpeg,我相信使用clang进行编译.在ffmpeg中有一个带有名为'class'的成员变量的结构.我相信这在C中完全没问题,但clang试图将其解析为关键字.知道怎么解决?基本上cpp文件中的以下内容会导致错误:
extern C {
typedef struct {
int class;
} SomeStruct;
}
Run Code Online (Sandbox Code Playgroud)
它试图将类解释为关键字.
FYI在ffmpeg中抛出错误的文件是libavcodec/mpegvideo.h,我需要包含它来访问MpegEncContext结构以提取运动图信息.
编辑
上面的代码示例只是为了演示错误.但也许它可以通过另一种方式解决.在我的实际代码中,我有这样的:
#ifdef __cplusplus
extern "C" {
#endif
#include "libavcodec/mpegvideo.h"
#include "libavformat/avformat.h"
#if __cplusplus
} //Extern C
#endif
Run Code Online (Sandbox Code Playgroud)
我如何将这两个文件包含为C文件而不是C++?
谢谢