0

I'm learning to write OpenGL programs. So far, I've been using C, but I'm realizing as the programs get more involved, it might be nice to program in a more object oriented way, so I'm setting up a skeleton program in C++.

This program couldn't be any simpler. Except that I get this error:

No matching function for call to glutInit()

I've seen this error in other posts, and I've implemented the suggestions, but the error remains. What am I doing wrong? Thanks!

chess.h

#ifndef __chess1__chess1__
#define __chess1__chess1__

#include <iostream>
#include <GLUT/GLUT.h>    //edited
#endif /* defined(__chess1__chess1__) */

chess.cpp

#include "chess.h"
using namespace std;

int main(int argc, char * argv[]) {

    glutInit();
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(1000, 1000);
    glutCreateWindow("Chess Program");
    glutMainLoop();
    exit(0);
}
4

1 に答える 1

1

glutInit(int* argcp, char** argv)1 つは argc へのポインターで、もう 1 つは argv です。次のように呼び出す必要がありますglutInit(&argc, argv)

http://www.opengl.org/documentation/specs/glut/spec3/node10.html

于 2013-09-22T21:46:00.837 に答える