Skip to main content
gamedev.net
🔒 Locked

SDL screen capture function error

Started by Undeadlnsanity 1 reply 2.8k views
Original Post
Undeadlnsanity
Undeadlnsanity
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 :-).
Drew_Benton
Drew_Benton
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.