Weird GLEW linker error (VS 2012)

Started by
1 comment, last by SomeGuyOnHisComputer 10 years, 10 months ago

Hi, I'm new to both C++ and OpenGL. I only know the basics of the former, and practically nothing about the latter.

So I've been trying to follow this series of tutorials: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/

I can get GLFW to open a window just fine (ignoring GLEW by commenting out some code).

Around glewExperimental=true; is where I start to get issues. (based on what I've read, I believe it should technically be glewExperimental=GL_TRUE, but I get the same errors regardless). I get linker error "LNK2001 unresolved external symbol" thrown at me every time I try to build the project with the glewExperimental variable referenced. If I were to take that out and continue onward to the next tutorial, I get the same error for things like ___glewBindVertexArray and ___glewGenVertexArrays.

Glew seems to initialize fine though, and through trial and error it seems like the IDE can see the .lib and header just fine after I put them in the same place as GLFW's respective lib and headers.

I have GLEW_BUILD defined, the DLL is in a place where it can be seen. As far as I know I'm using the correct lib for the DLL version (glew32.lib), I have these additional dependencies defined: glu32.lib opengl32.lib glfwdll.lib glew32.lib - in that order. I've tried adding some other ones such as gdi32.lib to see if that would make a difference, it didn't.

I've tried the debug version of GLEW, I've tried building it myself. I've spent hours googleing a solution with no avail. No one else is having the same issue so I figure I must be doing something wrong, but I have no idea what.

Advertisement

I don't have GLEW in front of me right now to check, but defining GLEW_BUILD sounds fishy. Typically, that sounds like a symbol that should only be defined while building the GLEW library itself, not anything depending on it.

You might have to define (or not define) GLEW_STATIC though depening on how you plan to link GLEW.

Commenting out the GLEW_BUILD definition solved everything. Thanks man! smile.png

I'm pretty sure I misread the GLEW documentation while making the assumption that dynamic libraries needed definitions because GLFW needed a definition. I guess it's time for me to learn about libraries.

This topic is closed to new replies.

Advertisement