xCode: .. was not declared in this scope

View previous topic View next topic Go down

xCode: .. was not declared in this scope

Post  oioioi on Thu Jun 25, 2009 12:19 pm

I got a struct named weapon_t in weapons.h file, inside game.h I have a struct that contain weapon_t, normally this works fine as long as I include weapons.h but now it doesn't. xCode gives me this error: "Error: 'weapon_t' does not name a type". I have tried including the file different way for almost an hour, but it just doesn't work. here is some of the code:

Code:
//weapons.h
#ifndef WEAPONS_H
#define WEAPONS_H

#include "template.h"


#define WEAPON_MAX_NAME_LENGHT 20
#define MAX_WEAPONS 2

typedef struct
{
   char name[WEAPON_MAX_NAME_LENGHT];
   unsigned char firemode;
   int ammo, maxammo;
   float recoil, accuracy, accuracy2;
   float reloadTime, reloadTimer;
   bool enable;
} weapon_t;


typedef enum
{
   SEMIAUTO,
   AUTO
} WEAPON_FIRE_MODE;

...

#endif

Code:
//game.h
#ifndef GAME_H
#define GAME_H
#include "template.h"


typedef struct
{
   SIO2object *obj, *gunObj;
   float life;
   float rotx, rotz;
   weapon_t weapons2[2];
   int wep;
} player_t;

...

#endif
template.h includes all files in the project, I have also tried including only the necessary files in every header file. This occur every time my project is starting to have many files. Do I include header files wrong?

Thanks!

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum