• Advertisement
Sign in to follow this  

SDL screen capture function error

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