I ran into this problem writing a C++ Glut engine myself. Here's how I worked around it:
I placed these at the top of my program.cpp / main.cpp
// Function prototypes
void doRendering( void );
void processMouse( int, int ) ;
void processMouseClick(int button, int state, int x, int y);
void keyboardInput(unsigned char c, int x, int y);
Assign these functions to glut's callbacks here:
glutDisplayFunc(doRendering);
glutIdleFunc(doRendering);
glutPassiveMotionFunc(processMouse);
glutMotionFunc(processMouse);
glutMouseFunc(processMouseClick);
glutKeyboardFunc(keyboardInput);
Create my own class which handles these on its own and then make the contents of our static functions simply call methods on the instance of this class. Your main function should create a new instance of the class in main (in my case... App *newApp).
void doRendering( void )
{
newApp->updateScene();
newApp->drawScene();
}
void processMouse(int x, int y)
{
newApp->processMouse(x, y);
}
void processMouseClick(int button, int state, int x, int y)
{
newApp->processMouseClick(button, state, x, y);
}
void keyboardInput(unsigned char c, int x, int y)
{
newApp->keyboardInput(c, x, y);
}
Hope that explains it.