Search code examples
openglmingwcodeblocksglew

GLEW Linker Errors (undefined reference to `__glewBindVertexArray')


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"


Solution

  • 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.