【发布时间】:2015-06-27 13:56:58
【问题描述】:
我已将新文件添加到项目中:
#ifndef PLAYER_H
#define PLAYER_H
#include "enet/enet.h" //the problem
typedef struct Player
{
ENetPeer * peer; //requires problematic include
//void * peer; //works, since no include required
} Player;
const struct Player playerEmpty;
#endif //PLAYER_H
如果存在include,我会在不相关的文件中获得大量error: expected ';', ',' or ')' before numeric constant。如果我删除include 并改用void * peer,一切都很好。 enet 库包含在其他地方的源文件中,并且工作正常。我正在使用 enet 1.3.13(最新),它的标头保护似乎就位。这是在 gcc 4.9.2 下。
记录在案错误发生在Point.h:
#ifndef POINT_H
#define POINT_H
#include <stdint.h>
#define X 0
#define Y 1
#define Z 2
typedef int16_t int16_Point2[2];
typedef int32_t int32_Point2[2];
typedef uint16_t uint16_Point2[2];
typedef uint32_t uint32_Point2[2];
typedef int16_t int16_Point3[3];
typedef int32_t int32_Point3[3];
typedef uint16_t uint16_Point3[3];
typedef uint32_t uint32_Point3[3];
#endif //POINT_H
我确定这很简单——知道我做错了什么吗?
【问题讨论】:
标签: c gcc compiler-errors enet