GLEW链接器错误(未定义对__glewBindVertexArray的引用) [英] GLEW Linker Errors (undefined reference to `__glewBindVertexArray')

查看:373
本文介绍了GLEW链接器错误(未定义对__glewBindVertexArray的引用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近决定使用不折旧的技术使用im重新编写游戏的OpenGL代码.而不是使用glBegin()和glEnd()绘制图元,我试图坚持使用顶点数组对象等.我正在尝试从 http:进行编译的代码: //www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/.我之前做过很多链接,但是由于某种原因,这是行不通的.我正在尝试使用CodeBlocks作为我的IDE和MinGW GCC作为我的编译器将GLEW链接到我的项目.我该如何解决这个问题?是的,我确实链接了"glew32.lib"

I've recently made the decision to re-write some OpenGL code for a game using im working on using non depreciated techniques. Instead of drawing primitives with glBegin() and glEnd(), i'm trying to stick to vertex array objects and such. I'm trying to get code to compile from http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/ . I've done alot of linking before but for some reason this isn't working. I'm trying to link GLEW to my project with CodeBlocks as my IDE and MinGW GCC as my compiler. How do I go about fixing this? Yes, i did link "glew32.lib"

推荐答案

如果您静态链接GLEW,但通常不会发生这种情况,通常会发生这种情况.为此,您必须定义预处理器令牌"GLEW_STATIC".最好将其作为编译器选项来完成.如果是GCC,请在编译器命令行中添加-DGLEW_STATIC.

This usually happens if you link GLEW statically, but don't inform the header about this to happen. For this you must define the preprocessor token "GLEW_STATIC". This is best done as a compiler option. In case of GCC, add -DGLEW_STATIC to your compiler command line.

这篇关于GLEW链接器错误(未定义对__glewBindVertexArray的引用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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