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

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

问题描述

我最近决定使用我正在使用非折旧技术为游戏重写一些 OpenGL 代码.我没有使用 glBegin() 和 glEnd() 绘制基元,而是试图坚持使用顶点数组对象等.我正在尝试从 http 获取要编译的代码://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/.我以前做过很多链接,但由于某种原因,这不起作用.我正在尝试将 GLEW 链接到我的项目,使用 CodeBlocks 作为我的 IDE,将 MinGW GCC 作为我的编译器.我该如何解决这个问题?是的,我确实链接了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天全站免登陆