glutKeyboardFunc problem


I am trying to use the glutKeyboardFunc function which takes the function myKeyboard as an argument, eg,


myKeyboard has the parameter list: unsigned char thekey, int x, int y

When I run the program I am getting an error:

[C++ Error] GlSkel.cpp(118): E2034 Cannot convert ‘void (* (_closure )(unsigned char,int,int))(unsigned char,int,int)’ to ‘void (*)(unsigned char,int,int)’.

Any ideas as to what i’m doing wrong???


Try cast the function pointer to the proper type.

glutKeyboardFunc(reinterpret_cast<void (*)(unsigned char,int,int)>(myKeyboard));