C编译错误

jar*_*ryd 1 c

编译时,以下错误意味着什么?

Tilemap.h:21: error: conflicting types for ‘ThreeDWorld’
Tilemap.h:21: error: previous declaration of ‘ThreeDWorld’ was here
Tilemap.h:29: error: conflicting types for ‘CGPoint’
Tilemap.h:29: error: previous declaration of ‘CGPoint’ was here
Tilemap.h:31: error: conflicting types for ‘tileForCoordinates’
Tilemap.h:31: error: previous declaration of ‘tileForCoordinates’ was here
Run Code Online (Sandbox Code Playgroud)

为什么它会出现错误?我的源文件有一个这样的实例

typedef struct
{
int xPosition;
int yPosition;
} 
CGPoint;
Run Code Online (Sandbox Code Playgroud)

Gra*_*and 5

您是否包含来自多个地方的头文件?如果是,请在头文件中使用guard.

例如,在Tilemap.h中:

 #ifndef TILEMAP_H
 #define TILEMAP_H

 // header file contents

 #endif /* TILEMAP_H */
Run Code Online (Sandbox Code Playgroud)