callback functions and C++

I’m writing OpenGL program in C++, and for each class, I have its specific Display, Mouse, Animate functions. But when I want to pass them into glutDisplayFunc, I get error saying “cannot convert parameter 1 from ‘void (void)’ to ‘void (__cdecl *)(void)’”. So I asked someone, who told me that I need to make these methods into C style, but he forgot the exact way to do that, and only mentioned something about extern “C”. So could anyone tell me exactly how to cast my methods as C functions so I can pass them into glutDisplayFunc?

Thanks a lot!

Try making the functions static class members.

… or write a non-member function that calls the member function and pass that function to glutDisplayFunc.