Compiling Simple static OpenGL 4.0 program using MinGW, freeglut and glew

前端 未结 2 1557
时光取名叫无心
时光取名叫无心 2020-12-17 03:49

The problem is in the title, I\'ll try to list what I\'ve already tried and so on below.

First off, in my understanding, in order to use OpenGL 4.0 on windows you mu

2条回答
  •  粉色の甜心
    2020-12-17 04:36

    Argument order is significant with gcc linker options.

    Try this:

    ${G++} -DFREEGLUT_STATIC -DGLEW_STATIC -m32 main.cpp -o main.exe -I ${ROOTPATH}/include -L ${ROOTPATH}/lib -lopengl32 -lwinmm -lgdi32 -lglew32 -static -lfreeglut_static 
    

    Also, I don't think there's a double-dash --static option, just -static.

    And on win32 you're going to need a successful glewInit() before your glEnableVertexAttribArray() function pointer will be valid. After checking your core version and/or extension, of course :)

提交回复
热议问题