如何使用GLEW与Code :: Blocks

问题描述:

这似乎是一个相当普遍的问题,我似乎无法找到一个解决方案。我读过的大多数论坛或问题都告诉你什么是错误的,但不要解释如何解决它。我已经尝试用Code :: Blocks设置GLEW,并且我现在还没有能够使它工作大约两周,所以没有太多我没有尝试过。我一直打链接错误,如:如何使用GLEW与Code :: Blocks

obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|57|undefined reference to `_imp____glewGenBuffers'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|59|undefined reference to `_imp____glewBindBuffer'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|61|undefined reference to `_imp____glewBufferData'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|63|undefined reference to `_imp____glewEnableVertexAttribArray'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|64|undefined reference to `_imp____glewBindBuffer'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|72|undefined reference to `_imp____glewVertexAttribPointer'| 
obj\Debug\src\Graphics.o:D:\cold-fusion-engine\ColdFusion\src\Graphics.cpp|77|undefined reference to `_imp____glewDisableVertexAttribArray'| 
||=== Build finished: 7 errors, 0 warnings ===| 

我的连接是如何设置: enter image description here

有一件事我读过,可能是错的是GLEW需要编译到glew32.a代替glew32.lib,但我无法使用Makefile与Cygwin一起工作。我也注意到这似乎是一些人们常见的问题。我知道这是很多要问,但有人可能编译GLEW为Mingw并上传它,或给出详细一步一步如何做到这一点?我在这方面遇到了比我应该更多的麻烦,这让我放弃了学习OpenGL 4并坚持使用OpenGL 1.2。

+0

@ moskito-x是的。 – cgasser 2012-08-15 04:19:52

+0

并且您通过ms​​ys使用mingw – 2012-08-15 06:29:54

我曾经想测试一个很大的问题,就是让glew-1.9.0。

我假设你有安装在同一个驱动器上的msys和mingw。例如C:\ MSYS \ 1.0 \和C:\ MinGW的*

  • 下载GLEW-1.9.0。
  • 设置env路径,首先插入路径变量x:\ msys \ 1.0 \ bin; x:\ mingw \ bin; ...
  • 将文件夹glew-1.9.0复制到x:\ msys \ 1.0的\ src \ GLEW-1.9.0
  • 开始msys.bat
  • cd到顶层/
  • cd到usr/src目录/ GLEW-1.9.0
  • 使

所有这些步骤花了大约10分钟。而在usr/src目录/ GLEW-1.9.0/lib文件夹中,我可以看到

libglew32.a .. 2012年8月15日 libglew32.dll.a .. 2012年8月15日 libglew32mx.a .. 2012年8月15日 libglew32mx.dll.a .. 2012年8月15日 glew32.dll .. 2012年8月15日 glew32mx.dll .. 2012年8月15日

那么问题出在哪里?