Jump to content
  • Advertisement
Sign in to follow this  
sleepy566

Expected primary expression before "," token - weird error

This topic is 3031 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

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
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?

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
Thanks. However, it seems that adding an extern does not fix the problem. The errors go away, but those four blits still do nothing.

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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!