【发布时间】:2012-05-10 13:11:52
【问题描述】:
之前有人问过很多问题:如何在 Windows 上使用 MinGW 编译 GLEW 1.7.0 源代码?目标是动态链接来自 c++ 项目的库。
更多信息:我正在使用 QtCreator,因此使用 qmake 进行构建。我在 Windows 7 上。到目前为止,我已经尝试/查看了以下链接。
use posted batch file also tried to replace gcc with g++
static with vc++ libs, build dll.a reuse vc++ .dll
simple stuff using GLEW msvc++ binaries, works on my desktop
不幸的是,当我在项目中使用编译结果时,所有发布的解决方案都以以下错误消息结尾:
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 路径和 Windows 路径变量,以包含 glew dll 所在的目录。 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 源代码的万无一失的说明?
【问题讨论】: