让GLEW在Code :: Blocks中编译 [英] Getting GLEW to compile in Code::Blocks

查看:376
本文介绍了让GLEW在Code :: Blocks中编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C ++中学习OpenGL,并且使用Code :: Blocks。我能够得到freeglut工作,以及几个在线的例子(以及CB的例子)。
然而,当我尝试包括GLEW的一些教程我跟踪,我得到以下编译器错误:

I'm wanting to get into and learn OpenGL in C++ and am using Code::Blocks. I was able to get freeglut to work, along with several online examples (as well as the example that ships with CB). However, when I try to include GLEW for some tutorials I'm following, I get the following compiler errors:

obj\Debug\main.o||In function `RenderSceneCB':|
C:\C Programs\OpenGL Test\main.cpp|12|undefined reference to `_imp____glewEnableVertexAttribArray'|
C:\C Programs\OpenGL Test\main.cpp|13|undefined reference to `_imp____glewBindBuffer'|
C:\C Programs\OpenGL Test\main.cpp|14|undefined reference to `_imp____glewVertexAttribPointer'|
C:\C Programs\OpenGL Test\main.cpp|18|undefined reference to `_imp____glewDisableVertexAttribArray'|
obj\Debug\main.o||In function `CreateVertexBuffer':|
C:\C Programs\OpenGL Test\main.cpp|34|undefined reference to `_imp____glewGenBuffers'|
C:\C Programs\OpenGL Test\main.cpp|35|undefined reference to `_imp____glewBindBuffer'|
C:\C Programs\OpenGL Test\main.cpp|36|undefined reference to `_imp____glewBufferData'|
||=== Build finished: 7 errors, 0 warnings (0 minutes, 0 seconds) ===|

无论我做什么,我尝试什么建议,我尝试链接的其他文件,我保持得到这些相同的错误。我有另一个人尝试的代码,他们说它的工作很好,但没有任何想法,我的GLEW设置有什么问题。

No matter what I do, what suggestions I try, what other files I try to link, I keep getting these same errors. I had someone else try the code and they said it worked just fine but didn't have any ideas as to what's wrong with my GLEW setup.

任何人有任何想法,

我使用的是Windows 7,Code :: Blocks 12.11,并下载了Ming32二进制文件GLEW 1.9.0。

I'm using Windows 7, Code::Blocks 12.11, and downloaded Ming32 binaries for GLEW 1.9.0.

我的链接器设置按此顺序设置:

My linker setting is set up in this order:

glew32
freeglut
opengl32
glu32
winmm
gdi32

glew32 freeglut opengl32 glu32 winmm gdi32

推荐答案

链接器设置有问题。您必须链接

You have problem in linker setting. You have to link


glew32s.lib

不仅 glew32.lib ,还必须链接 glew32s.lib 。确保它必须在链接列表的顶部

Not only glew32.lib you must link glew32s.lib also .Be sure that it must be at the top of the list of linker.

写代码时不要忘记定义


#define GLEW_STATIC

在源文件的顶部。

这篇关于让GLEW在Code :: Blocks中编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆