Sign in to follow this  
tjrr3d

struct access

Recommended Posts

I've got a structure defined in my menu.h file for some items called item_t. So in my screensaver file I want to create a item of item_t, but the compiler gripes saying "missing storage-class or type specifiers" even when I include my menu.h file. Obviously something I'm doing is wrong, but what? Heres a bit of some code:
menu.h

typedef struct
{
	int		w, h;
	int		timer1;
	int		timer2;
	int		Original;
	
	float	x, y, dx, dy;
	float	angle, zoom;
	bool	paused;
	SDL_Surface *img;
	SDL_Surface *loadBarImg;
}item_t;


ScreenSaver.h


#include "menu.h"

item_t MoveBodyTxt;  <-- Gripes here, why?


Share this post


Link to post
Share on other sites
That should fix it.

typedef struct item_t
{
int w, h;
int timer1;
int timer2;
int Original;

float x, y, dx, dy;
float angle, zoom;
bool paused;
SDL_Surface *img;
SDL_Surface *loadBarImg;
}item_t;

Share this post


Link to post
Share on other sites
You are not compiling what you think you are compiling.

Add:
#ifdef COMPILER_ERROR
int x[0];
int z = foozball;
// the odds are one of these two lines will generate a compiler error.
#endif
to menu.h

In ScreenSaver.h:
#define COMPILER_ERROR
#include "menu.h"
#undef COMPILER_ERROR

I'm betting that somehow you aren't including the menu.h you think you are.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this