PDA

View Full Version : error: arguments do not match in glutReshapeFunc(), glutDisplayFunc()



JackR
01-30-2007, 10:28 AM
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

jide
01-30-2007, 10:44 AM
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.

JackR
01-30-2007, 10:53 AM
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 match `void (*)(int, int)' for glutRehapeFunc()

and

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

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

jide
01-31-2007, 01:48 AM
Then my guess is that it is due to the fact that you use namespaces.

Overmind
01-31-2007, 04:30 AM
Are the functions members of a class? If so, they have to be static, normal members won't work.

jide
01-31-2007, 07:08 AM
yes right I don't know why I was on the namespace stuff...