Jump to content
  • Advertisement
Sign in to follow this  
Undeadlnsanity

SDL screen capture function error

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

In an application that I'm working on I'm implementing a screenshot function using SDL. The function is as follows:
void SDLScreen::captureScreen() {
        SDL_SaveBMP(SDL_Surface* m_screen, char* File);
}

My surface is defined as:
SDLScreen::SDLScreen(SDL_Surface* screen) : m_screen(screen), m_gcn_graph(new gcn::SDLGraphics()) {
		m_gcn_graph->setTarget(m_screen);

I don't seem to able to spot any problems with either pieces of that code, but whenever I try to compile the code I receive the following errors:
error: expected primary-expression before '*' token.
error: expected exeression before 'char'.
The errors occur within the definition of the captureScreen() function. Any help is greatly appreciated. Thank you very much :-).

Share this post


Link to post
Share on other sites
Advertisement
For the first function:

void SDLScreen::captureScreen()
{
SDL_SaveBMP(SDL_Surface* m_screen, char* File);
}

You are declaring the function instead of using it [wink]. It should be

void SDLScreen::captureScreen()
{
SDL_SaveBMP(m_screen, File);
}

Where m_screen is the SDL_Surface* that represents the screen being saved and File is a valid C-style string that contains the file name to save to.

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!