Jump to content
  • Advertisement
Sign in to follow this  
tjrr3d

struct access

This topic is 4480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Actually yeah. I just tested your original code on Visual Studio 2005 and it compiled fine.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!