error: expected declaration specifiers or '...' before 'xxxx'(xxxx是函数形参)
今天汗颜了一大阵
早上,在编译我的源代码的时候竟然不通过编译,上个星期六也出现了这种情况,当时不知道怎么弄的后来又通过编译了,可能是原来的.o文件没有make clean 还保存在那里,以至于蒙过去了,我的代码也已经用SVN提交了,真是致命(污染了项目的源码)。好在我当即解决了。
编译出错提示:
……………………
error: expected declaration specifiers or '...' before 'WEB_VOICE_VAR'
情形描述:
结构体变量WEB_VOICE_VAR var 定义在 a.c 中,a.h声明 了 extern WEB_VOICE_VAR var.我在b.c 想使用a.c中已经赋值了的var结构体的成员的值,于是在b.h中#include"../../a.h",然,出现了上面的编译错误。
原因分析:
网上搜索,讨论的不少,越看越茫然。
可能原因是
b.h中#include "../../a.h" 而a.h中的函数声明中用到了b.h中的结构体或者typedef,那么就会出现在包含a.h的时候b.h中的结构体或者typedef还没有声明,从而陷入错误.
解决办法:
将#include "../../a.h"直接放到b.c中,当再次make 的时候,pass了
error: expected declaration specifiers or '...' before 'xxxx'(xxxx是函数形参)的更多相关文章
- XXX.h:143: error: expected declaration specifiers or ‘...’ before ‘YYY’
出现上面头文件错误,原因是定义YYY的头和XXX.h互相包含了
- expected declaration specifiers or '...' before string constant
/work/platform_bus_dev_drv/led_dev.c:52: error: expected declaration specifiers or '...' before stri ...
- error: expected declaration or statement at end of input----solved
error: expected declaration or statement at end of input 解决方法: 1.程序缺少一个括号相应地 2.而不添加头文件 版权声明:本文博主原创文章 ...
- Could not obtain information about Windows NT group/user 'xxxx\xxxx', error code 0x5
案例描述 昨晚踢球回来,接到电话说一个系统的几个比较重要作业出错,导致系统数据有些问题.让我赶紧检查看看.检查作业日志时发现,作业报如下错误(关键信息用xxx替换) The job failed. ...
- Cocos2d-x 3.0 编译出错 解决 error: expected ';' at end of member declaration
近期把项目移植到cocos2d-x 3.0,在整Android编译环境的时候,出现一大堆的编译出错,都是类似"error: expected ';' at end of member dec ...
- error: expected constructor, destructor, or type conversion before '.' token
今天写代码是遇到这样一个问题error: expected constructor, destructor, or type conversion before '.' token:立马网上查,原来是 ...
- C和指针 第十二章 结构体 整体赋值 error: expected expression
定义结构体后整体赋值时发生错误 typedef struct NODE { struct NODE *fwd; struct NODE *bwd; int value; } Node; //声明变量 ...
- 坑备忘error: expected class-name before '{' token
今日重构之前的代码,修改了命名空间,然后一处派生的子类定义处总是总是报error: expected class-name before '{' token,网上查了查原因,出现这种情况大致有两种情况 ...
- could not build module 'XXXXXXXX'或者error: expected identifier or '(' 。一堆奇怪的错误————错误根源
一堆奇怪的错误:1⃣️could not build module 'XXXXXXXX' 2⃣️error: expected identifier or '(' 3⃣️EDIT Setting Pr ...
随机推荐
- oracle字符串处理函数--待整理
http://www.cnblogs.com/xd502djj/archive/2010/08/11/1797577.html http://blog.csdn.net/qq373591361/art ...
- spring sessionFactory 属性配置详解,applicationContext中各种属性详解
1.Bean的id为sessionFactory,对应的类为AnnotationSessionFactory,即采用注解的形式实现hibernate. 2.hibernateProperties,配置 ...
- Spring AOP声明式事务异常回滚(转)
转:http://hi.baidu.com/iduany/item/20f8f8ed24e1dec5bbf37df7 Spring AOP声明式事务异常回滚 近日测试用例,发现这样一个现象:在业务代码 ...
- cocos2dx 3.x fullPathForFilename及isFileExist在ios/mac下与win32下行为不同
一,fullPathForFilename 项目先开发了ios/mac版本,这两天想把win32工程也配好,但遇到了部分资源无法正确找到的问题. 进一步观察发现,对于那些找不到的资源路径,fullPa ...
- 关于java集合类TreeMap的理解(转)
概要 这一章,我们对TreeMap进行学习. 转载请注明出处:http://www.cnblogs.com/skywang12345/admin/EditPosts.aspx?postid=33109 ...
- ubuntu下gcc-avr安装
ubuntu下研究arduino时发现,原来可以不用arduino IDE开发,linux下还有gcc-avr直接开发avr系列的控制器. 于是,迫不及待的查看了下相关资料,总结一下安装gcc-avr ...
- MySQL抓包工具:MySQL Sniffer 和性能优化
简介 MySQL Sniffer 是一个基于 MySQL 协议的抓包工具,实时抓取 MySQLServer 端的请求,并格式化输出.输出内容包访问括时间.访问用户.来源 IP.访问 Database. ...
- ssh 远程执行命令 -t
# ssh -p22022 -t 122.16.67.116 ls -l /root/.ssh total -rw-r--r-- root root Jan : authorized_keys -rw ...
- angular -- $routeParams API翻译
原api出处: https://docs.angularjs.org/api/ngRoute/service/$routeParams $routeParams 可以获取当前路径参数. 需要ngrou ...
- sass & compass 实战录
一.sass 是什么 Css的一种预处理器 是基于css进行语法扩展而成 主要目的是为了提高开发效率,弥补css语法不足的缺陷 同样流行的预处理器还有:less.stylus 二.SASS的基本语法 ...