C++ – XCode project cannot recognize certain GLUT commands

cglutopenglxcodebuild

I'm creating a GLUT/OpenGL project in XCode 4. I've added the glut/opengl frameworks, linked all my libraries together-all is good, except for some reason my main() function won't accept glutInit(&argc, argv) and gives me the error message that "there's no matching function call to glutInit(). The strange thing though is that it accepts some of the other glut functions like glutInitDisplayMode() and glutCreateWindow() but just not glutInit().

Also, I'm using 3 callback functions

glutDisplayFunc(DisplayCallback)    
glutReshapeFunc(ReshapeCallback)    
glutKeyboardFunc(KeyboardCallback) 

My project accepts only the first one, but does not recognize the other two, giving the same error as it does with glutInit().

Any ideas as to what could be going wrong?

Best Answer

I've had exactly the same error.

I have finally solved the problem by making changes to the argument of the main() function.

See if the argv is declared as const. Removing it from the main function argument made glutInit error disappear.

// delete const from argv declaration 
int main(int argc, const char * argv[]) // from this,
int main(int argc, char * argv[])       // to this.