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 ...
随机推荐
- java各种数据类型之间的转换
1如何将字串 String 转换成整数 int? A. 有两个方法: 1). int i = Integer.parseInt([String]); 或 i = Integer.parseIn ...
- 微服务之springcloud技术栈
一.微服务架构图: 二.技术介绍:(技术选型随着代码的编写会完成) 关于技术选型,我盗了一张微服务技术栈的图,如下:原文:http://www.jianshu.com/p/2da6becfb019 我 ...
- ubuntu图形界面调出命令行
新安装的ubuntu12.04在左边的快捷方式里默认是没有终端图标的,可以使用如下方法打开终端: 使用ctrl+alt+t.这个组合键适合ubuntu的各种版本.但是,在使用KVM虚拟机时可能会出现问 ...
- ny225 小明求素数积
小明求素数积时间限制:1000 ms | 内存限制:65535 KB 难度:1描述 小明最近遇到了一个素数题,是给你一个正整数N(2=<N<=1000)让你求出2~N的所有素数乘积的后 ...
- mysql出现The total number of locks exceeds the lock table size解决办法
mysql命令行下查看show variables like 'innodb_buffer_pool_size'; 修改innodb_buffer_pool_size值: windows下面 my.i ...
- sqlserver中sp_executesql使用实例(获取动态sql输出结果)
语法 sp_executesql [ @stmt = ] stmt [ {, [@params=] N'@parameter_name data_type [ [ OUT [ PUT ][,. ...
- c++之——抽象基类
在一个虚函数的声明语句的分号前加上 =0:就可以将一个虚函数变成纯虚函数,其中,=0只能出现在类内部的虚函数声明语句处.纯虚函数只用声明,而不用定义,其存在就是为了提供接口,含有纯虚函数的类是抽象基类 ...
- plot sin 04 坐标轴居中
plot sin 04 坐标轴居中 code #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matpl ...
- 【Android】使用Pull生成/解析XML文件
一.生成XML文件,即是将对象集合转为XML文件存储. 对象集合 –> XML(序列化) Android中使用android.util.Xml类对其进行了描述,提供相应的API. 步骤大致如下: ...
- 【C#/WPF】键盘事件
需求:按下回车键,触发事件. 搜MSDN时,看到的键盘事件是System.Windows.Forms里的,在WPF中没法用: https://msdn.microsoft.com/zh-tw/libr ...