【发布时间】:2011-09-25 11:04:10
【问题描述】:
我一直在使用 GCC 4.6 开发我的应用程序进行编译,但用户报告了“重新定义 typedef”错误。在我错误地告诉用户使用 Git 获取最新源的一些混乱之后,我仔细查看并发现了类似的内容:
/* mystruct.h */
#ifdef MYSTRUCT_H
#define MYSTRUCT_H
typedef struct _mystruct mystruct
#endif
/* mystruct.c */
#include "mystruct.h"
typedef struct _mystruct
{
int a;
int b;
} mystruct;
对于较旧的 GCC 版本,这很容易修复,但为什么这不再是错误?还是需要报告?
【问题讨论】:
-
不能...等...直到...我们用实际的...脚本语言...替换...C预处理器...例如PHP或客观的C smalltalk模拟...
标签: gcc compiler-errors typedef redefinition