这个问题已经被问得很多了:如何在Windows上使用MinGW编译GLEW 1.7.0源代码?目标是从C++项目中动态链接到库。
更多信息:我正在使用QtCreator,因此用qmake进行构建。我使用的是Windows 7。到目前为止,我尝试/查看了以下链接。
vc++ libs静态链接,构建dll.a重用vc++ .dll
使用GLEW msvc++二进制文件的简单方法,在我的台式机上有效
不幸的是,当我在项目中使用编译结果时,所有发布的解决方案都会出现以下错误消息:
undefined reference to `glDrawElements@16'
debug/Ex04.o: In function `Z6initGLv':
undefined reference to `glClearColor@16'
undefined reference to `glEnable@4'
debug/Ex04.o: In function `Z8updateGLv':
undefined reference to `glClear@4'
undefined reference to `glViewport@16'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug/ecg4.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
我对这个问题束手无策。我已经双倍和三倍地检查了qmake中的LIBS路径和包含glew dll所在目录的windows路径变量。此外,qmake的INCLUDEPATH也应该是正确的。以下是.pro文件中的路径:
LIBS += -L$$quote(C:/mypath/freeglut/lib/) -lfreeglut
LIBS += -L$$quote(C:/mypath/glew-1.7.0/lib/) -lglew32 -lglew32mx
#LIBS+= C:/mypath/glew-1.7.0/lib/libglew32.dll.a
#LIBS+= C:/Programming/glew-1.7.0/lib/libglew32mx.dll.a
#includepath for project and the required libraries
INCLUDEPATH += ./include
INCLUDEPATH += "C:/mypath/glew-1.7.0/include"
INCLUDEPATH += "C:/mypath/freeglut/include"
有没有人能够给出一套绝对可靠的指令,告诉我如何使用MinGW编译GLEW 1.7.0源代码?