Sign in to follow this  
sleepy566

Expected primary expression before "," token - weird error

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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