Expected primary expression before "," token - weird error

Started by
5 comments, last by sleepy566 13 years, 11 months ago
Pretty straightforward, I try to compile this game I'm trying to get running and it gives me these 4 errors:
character.h: In member function 'void character::show()':
character.h:169: error: expected primary-expression before ',' token
character.h:173: error: expected primary-expression before ',' token
character.h:177: error: expected primary-expression before ',' token
character.h:181: error: expected primary-expression before ',' token
For fear of taking up too much room I have pasted my character.h file externally here: http://pastebin.com/NXpuygHE All it gets from camera.h is the following:
SDL_Rect camera = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
And all it gets from blit.h is this:
void blitSurface(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip)
{
	SDL_Rect offset; 
	
	offset.x = x;
	offset.y = y;
	
	SDL_BlitSurface(source, clip, destination, &offset); 
}
This is my first 2D game, I am still learning SDL, and I can't say I'm the best C++ programmer I know. All/any help is appreciated.
Advertisement
Your function calls look like this:
blitSurface(x - camera.x, y - camera.y, character, screen, &clipRight[frame])

What is the third argument? Where do you expect this value to come from?
It comes from a global variable in another file, but that is included before it. So it should still have access to it, right?

And to clarify the third parameter takes the image I want to blit, the fourth where I want to blit it.
You need to check out this: Global Variables Across Fles
Thanks. However, it seems that adding an extern does not fix the problem. The errors go away, but those four blits still do nothing.
Can you post the code for initializing SDL and flipping the screen surface?
Sure, whatever you need.
bool init(){		if(SDL_Init(SDL_INIT_EVERYTHING) == -1) 	{		printf("SDL initialization failed\n");		return false;	}		screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_SWSURFACE); 		if(screen == NULL)	{		printf("screen format failed\n");		return false;	}		SDL_WM_SetCaption("SDL Minigame Attempt", NULL);		return true;}int flipScreen() {	if(SDL_Flip(screen) == -1)	{		printf("flipscreen failed\n");		return 1;	}		return 0;}

The printf's are just for debugging purposes and will be removed eventually.

This topic is closed to new replies.

Advertisement