博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
error C2054: 在“inline”之后应输入“(”
阅读量:3528 次
发布时间:2019-05-20

本文共 1232 字,大约阅读时间需要 4 分钟。

#include 
#include
/*extern "C"{#include
}*/int main(int argc, char **argv){ AVFormatContext *fmt_ctx = NULL; int ret; av_register_all(); if ((ret = avformat_open_input(&fmt_ctx, "bad.mp4", NULL, NULL))) return ret; avformat_close_input(&fmt_ctx); return 0;}

出现以下错误:

1>g:\coding\ffmpeg\ffmpeg-20160413-git-0efafc5-win32-dev\include\libavutil\error.h(109): error C2054: 在“inline”之后应输入“(”

1>g:\coding\ffmpeg\ffmpeg-20160413-git-0efafc5-win32-dev\include\libavutil\error.h(110): error C2085: “av_make_error_string”: 不在形参表中
1>g:\coding\ffmpeg\ffmpeg-20160413-git-0efafc5-win32-dev\include\libavutil\error.h(110): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>g:\coding\ffmpeg\ffmpeg-20160413-git-0efafc5-win32-dev\include\libavutil\mem.h(93): error C2054: 在“inline”之后应输入“(”

wikipedia解释:

C++,C99和GNU C都支持内联函数,然而1989 ANSI C,这个最被广泛使用的C标准却不支持inline。

解决方案是:在该头文件中加入

#if defined(WIN32) && !defined(__cplusplus)#define inline __inline#endif

或者直接写CPP程序

#include 
extern "C"{#include
}int main(int argc, char **argv){ AVFormatContext *fmt_ctx = NULL; int ret; av_register_all(); if ((ret = avformat_open_input(&fmt_ctx, "bad.mp4", NULL, NULL))) return ret; avformat_close_input(&fmt_ctx); return 0;}

你可能感兴趣的文章