我在项目中添加了一个新文件:
#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
我敢肯定这很简单-知道我做错了什么吗?