• Advertisement
Sign in to follow this  

Weird GLEW linker error (VS 2012)

This topic is 1682 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Edited by SomeGuyOnHisComputer

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement