No matching function for call to 'SDL_AddTimer'

//Set callback
SDL_TimerID timerID = SDL_AddTimer( 3 * 1000, callback, “3 seconds waited!” );

At LAZYFOO’S TUTORIAL 45 I got that error on the above line.
Any help?

Does your “callback” function look like this?

Uint32 SDLCALL callback(Uint32 interval, void *param)
{
    // your code goes here
}

First of all thank you so much @icculus for you post. Well, the code is exactly just as LazyFoo’s SDL tutorial 45th. So the “callback” function is at below.

Uint32 callback( Uint32 interval, void* param )
{
//Print callback message
printf( “Callback called back with message: %s\n”, (char*)param );

return 0;

}

I have fixed it! There is no problem with callback function.
It was:

I changed it to this: (the solution)

//Set callback
std::string pre_param = “3 seconds waited!”;
char* param = &pre_param[0u];
SDL_TimerID timerID = SDL_AddTimer( 3 * 1000, callback, param );

I would think creating an std::string is unnecessary. Seems like the compiler is not recognizing a string literal as a pointer type. What compiler is this? If this is the problem, something like this should probably work:

SDL_TimerID timerID = SDL_AddTimer( 3 * 1000, callback, (void*) "3 seconds waited!" );

or maybe:

char* param = "3 seconds waited!";
SDL_TimerID timerID = SDL_AddTimer( 3 * 1000, callback, param);

Both worked. Your first offer worked without warning but second with warning. Anyway, your suggestions worked.

(It’s probably that “3 seconds waited!” is a const char *, instead of a char *. Some compilers are more agreeable about that than others. You should still have that SDLCALL on your callback, but in many cases it’s harmless to have it either way.)