error: expected declaration specifiers or '...' before错误
2012-09-10 08:34
501 查看
原因:头文件包含混乱!!
是因为头文件的包含顺序引起的。error: expected declaration specifiers or '...' before 这个错误是在Linux下面C语言的头文件包含问题产生的,如果a.h中#include b.h,而b.h中的函数声明中用到了a.h中的结构体或者typedef,那么就会出现在包含b.h的时候a.h中的结构体或者typedef还没有声明,从而陷入错误,可以把结构体或者typedef移入到b.h就万事大吉了。
http://blog.csdn.net/melong100/article/details/6426161 http://topic.csdn.net/u/20100406/14/db635336-35ea-4e47-8e42-4627224603c0.html?809534510 http://www.ixpub.net/thread-1451317-1-1.html
是因为头文件的包含顺序引起的。error: expected declaration specifiers or '...' before 这个错误是在Linux下面C语言的头文件包含问题产生的,如果a.h中#include b.h,而b.h中的函数声明中用到了a.h中的结构体或者typedef,那么就会出现在包含b.h的时候a.h中的结构体或者typedef还没有声明,从而陷入错误,可以把结构体或者typedef移入到b.h就万事大吉了。
http://blog.csdn.net/melong100/article/details/6426161 http://topic.csdn.net/u/20100406/14/db635336-35ea-4e47-8e42-4627224603c0.html?809534510 http://www.ixpub.net/thread-1451317-1-1.html
相关文章推荐
- C语言错误 [Error] expected declaration specifiers or '...' before 'student'
- 【错误】error: expected declaration specifiers or ‘...’ before string constant
- 安装PHP时 jpeglib.h:954: error:expected declaration specifiers or ‘...’ before ‘FILE’ 错误解决
- error: expected declaration specifiers or ‘...’ before ‘FILE’
- 【错误笔记】error: expected declaration specifiers or '...' before XXX
- error expected declaration specifiers or ‘...’ before ‘SElemType’
- 3:16: 错误: expected declaration specifiers or ‘...’ before string constant
- /home/zhang/code/hello/hello.c:3: error: expected declaration specifiers or ‘...’ before string cons
- error: expected declaration specifiers or '...' before ***
- XXX.h:143: error: expected declaration specifiers or ‘...’ before ‘YYY’
- /sysroot/usr/include/search.h:19: error: expected declaration specifiers or '...' before '__free_fn_
- error: expected declaration specifiers or ‘...’ before string constant
- libpam:shadow.h:error: expected declaration specifiers before '__THROW'
- error: expected declaration specifiers or '...' before xxx(xxx是函数形参)
- 在Ubuntu gcc下编译c程序,错误如下: test.c:3: error: expected ';', ',' or ')' before '&' token
- 编译错误:error: expected '=', ',', ';', 'asm' or '__attribute__' before...
- C语言错误:error: expected ':', ',', ';', '}' or '__attribute__' before '=' tok 4000 en
- 【Linux】【Debug】编译错误error: two or more data types in declaration specifiers
- error: expected declaration specifiers before ‘return’
- linux error: expected declaration specifiers or '...' XXX