Error: arguments do not match in glutReshapeFunc(), glutDisplayFunc()

Hello,

I am new to OpenGL and am working on cleaning up someone else’s code in Linux. My problem is that whenever I call glutDisplayFunc(class::myfunc_display) or glutReshapeFunc(class::myfunc_reshape), I get the error message:
error: argument of type void (class:: ) (int, int)' does not match void (*)(int, int)’ for glutRehapeFunc()

and

error: argument of type void (class:: ) ()' does not match void (*)()’ for glutDisplayFunc()

What puzzles me is that this code has run before with the same functions in the same class as they are now. This leads me to believe that I am missing an essential line of code, but as I am new, I do not know what that might be. I do include <glut.h> in my header file and the following lines run without incident:

 

  glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

  glutInitWindowSize (640+GAP*3, 512+GAP*3); 

  glutInitWindowPosition (100, 100); 

  window = glutCreateWindow ("VOLUME"); 
 

Does anyone have any suggestions?

Thanks in advance,
JackR

Well, the display function does not expect any argument, the prototype must be:

void DisplayFunc (void);

This is what I see from what you say.

I mis-typed the message originally and switched what error goes to what function. You are correct in that the display function does not expect any arguments, and the protype function does not have any arguments.

My error messages are:
error: argument of type void (class:: (int, int)' does not matchvoid (*)(int, int)’ for glutRehapeFunc()

and

error: argument of type void (class:: ()' does not matchvoid (*)()’ for glutDisplayFunc()

The original post has also been edited to correct my mistake.

Then my guess is that it is due to the fact that you use namespaces.

Are the functions members of a class? If so, they have to be static, normal members won’t work.

yes right I don’t know why I was on the namespace stuff…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.