【发布时间】:2011-08-21 14:56:27
【问题描述】:
我环顾四周并尝试了一些东西,目前没有任何效果。
main.c:13: error: two or more data types in declaration specifiers
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
我的代码差不多就是这个(我已经把所有的东西都注释掉了,所以它不是别的东西+除此之外没有其他文件);
main.h
struct savetype{
bool file_exists;
}
main.c
#include "main.h"
extern struct savetype save;
int main (void){
return 0;
}
stuff.c
#include "main.h"
struct savetype save;
save.file_exists=true;
【问题讨论】:
-
另外,如果我在 main.h 中向“struct savetype{/*stuff*/}”添加分号,我会收到此错误:stuff.c:4: error: expected '=', ',', ' ', 'asm' 或 'attribute' 在 '.' 之前令牌
-
我不相信 C 中有 bool 数据类型。
-
@Rafe:c99 有一个原生的
bool类型,现在大多数编译器都支持它。 -
@dmckee:
bool仅在您拥有#include <stdbool.h>时可见。
标签: c declaration specifier