Problem linking to Glew on Windows 64 bit and Visual Studio 2010

Started by
3 comments, last by nonsenseinc 11 years, 5 months ago
I'm having a problem linking to glew in vs 2010, looking on google it seems a few other people have had similar issues running Glew on 64 bit windows.

I have my project linked to the glew32.lib and freeglut.lib. Freeglut is working without problem, so the libs and headers are all in the right place. Running my program gives me a bunch of "unresolved external symbol" errors to various glew functions. I have tried building Glew from source, which seems to have fixed similar issues for other people, but no joy. Does anyone have any other suggestions for things I could try before I give up?
Advertisement
When you say "unresolved external symbol", I assume you are referring to the linker error? In that case, you are not "running your program", the IDE tries to compile it but fails at the linking stage. The most likely scenario is either not telling the linker to link to the library (with #pragma or in the linker options) or you try to link to an x86 library (in my experience the linker accepts a x86 library in x64 projects but just does not load any symbols from there).

That said, when describing a problem, always report any errors as verbatim as possible. Never paraphrase them.
You've probably tried some of this already, but here are some possibilities.

If this is happening when you actually run, then you need to place the glew32.dll where your OS can find it (Same dir as your executable would work, which is <Solution dir>\Debug or <Solution dir>\Release.

If you're trying to link statically with glew, you'll need to link to glew32s.lib (for release) and glew32sd.lib (for debug).

Finally, check and see if the first error isn't something like "Couldn't find library glew32.lib". If that's the case, you need to tell the linker about the folder your glew32.lib is in. (Project properties -> Linker -> General, modify "Additional library locations")
Thanks for the responses guys, I managed to fix it in the end, by putting all the headers and libs in Program Files(x86)/Microsoft SDKs/Windows/v7.0A, and removing them from the VC 2010 include and lib directories. I had assumed that the headers and libs could be in either place, perhaps this is not the case.
I also use glew on Visual Studio and compile for x86 and x64. I ran into the same problem and I fixed it by adding GLEW_STATIC to the preprocessor variables (you can also add a #define) and put the includes in my project folder and added the glew.c to my project. In a way I am not using it as a library but include it directly in my code. I would gladly provide a project template as I see many people run into this problem, but I have a different error that currently blocks my project. If you want I can upload it later...

This topic is closed to new replies.

Advertisement