Friday, May 4, 2012

GLEW VS2010 Wont Link?!?!

This is quite a painful problem that can actually be solved easily if you know what to do.

You'll want to use the static library  (glew32s.lib) and define the preprocessor directive 'GLEW_STATIC'.
You should be able to just download the Windows binaries for this but you can build it yourself also if you'd like (it's also simple to do).

With Binaries:

  • Download glew (32 and 64 as you may need to try both. 32 will probably work though).
  • Properties > Linker > Input > Additional Dependencies : Add ( glew32s.lib, glu32.lib, opengl32.lib ).
  • Properties > General > Additional Library Directories : Add ( --your path to the glew libs-- ).
  • Properties > C/C++ > Preprocessor > Preprocessor Definitions : (Add --GLEW_STATIC-- ).
  • Copy the glew32.dll into the folder with your programs executable.
Building yourself:
  • Download glew.
  • Open up the build/vc6 project.sln.
  • Change build target from Debug to Release.
  • Go to the solution explorer on the right( or left ) side of VS2010 > right click static > build.
  • Copy the newly built .lib to what ever folder you use for your project's libraries.
  • Copy the glew32.dll into the folder with your programs executable.

And that should do it.

I can't stress enough how much of a rut I was stuck in trying to get this to work. Hours down the drain. Rage and frustration at an ever-living wall of linker errors for methods I knew should be linking.

So seriously, use the static build, make your call to glewInit(), and get back to the real work of your project.

Thanks for the solution go to ( many others not included here )

No comments:

Post a Comment