2

我想编译一个 GLUT 程序

#include <GL/glut.h>

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

    // init GLUT and create Window
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(320,320);
    glutCreateWindow("Lighthouse3D- GLUT Tutorial");

    return 1;

}

编译和链接命令:

gcc -o main.exe main.c -lglut32

结果:

main.o:main.c:(.text.startup+0x1c): undefined reference to `glutInit'
main.o:main.c:(.text.startup+0x28): undefined reference to `glutInitDisplayMode'
main.o:main.c:(.text.startup+0x3c): undefined reference to `glutInitWindowPosition'
main.o:main.c:(.text.startup+0x50): undefined reference to `glutInitWindowSize'
main.o:main.c:(.text.startup+0x5c): undefined reference to `glutCreateWindow'
collect2: ld returned 1 exit status        

glut的实际lib文件(3.7.6,称为glut32.lib)在mingw的lib文件夹中,include文件在include/GL中。

现在要做什么?

4

1 回答 1

2
于 2012-10-16T21:46:42.480 回答