zoukankan      html  css  js  c++  java
  • error C2054: 在“inline”之后应输入“(”

    #include <stdio.h>
    #include <libavformat/avformat.h>
    /*
    extern "C"
    {
    #include <libavformat/avformat.h>
    }
    */
    
    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:codingffmpegffmpeg-20160413-git-0efafc5-win32-devincludelibavutilerror.h(109): error C2054: 在“inline”之后应输入“(”
    1>g:codingffmpegffmpeg-20160413-git-0efafc5-win32-devincludelibavutilerror.h(110): error C2085: “av_make_error_string”: 不在形参表中
    1>g:codingffmpegffmpeg-20160413-git-0efafc5-win32-devincludelibavutilerror.h(110): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>g:codingffmpegffmpeg-20160413-git-0efafc5-win32-devincludelibavutilmem.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 <stdio.h>
    extern "C"
    {
    #include <libavformat/avformat.h>
    }
    
    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;
    }
    



    Keep it simple!
    作者:N3verL4nd
    知识共享,欢迎转载。
  • 相关阅读:
    Spring 由缓存切点驱动的通知者
    Spring 缓存切面
    Spring 缓存注解 SpEL 表达式解析
    Spring 缓存注解解析过程
    SpEL 实例
    占位符解析
    RequestMapping 注解的解析、匹配、注册
    构建与众不同的软件
    [转载]Windows服务编写原理及探讨(4)
    [转载]Windows服务编写原理及探讨(3)
  • 原文地址:https://www.cnblogs.com/lgh1992314/p/5834697.html
Copyright © 2011-2022 走看看