[SDL] Thread problem; function call missing argument list

Ulrich Eckhardt doomster at knuut.de
Sun Apr 15 15:25:02 PDT 2007


On Sunday 15 April 2007 21:43, Edward Byard wrote:
> I'm using threads for the first time, and I have a class (singleton) where
> I am setting up a thread:

I'd suggest not mixing several things, remove the class and the singleton to 
narrow the fault to the most simple example.

> SDL_Thread *myThread = NULL; // global

Why global?

> MyClass::MyClass(void) // constructor
> {
>     myThread= SDL_CreateThread(myThreadFunction,NULL);
> }

FYI: the void in the argument list is optional in C++.

> int MyClass::myThreadFunction(void *data)
> {
>     return 0;
> }
>
> When I compile, I keep getting:
>
> error C3867: 'MyClass::myThreadFunction': function call missing argument
> list; use '&MyClass::myThreadFunction' to create a pointer to member

Read the C++ FAQ at parashift's. It explains the difference between a function 
and a memberfunction and also how to combine those two.

Uli


More information about the SDL mailing list