Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glew in VS 2010: unresolved external symbol __imp__glewInit

I am learning OpenGL by following the Redbook. When I come to around page 90, I need use glGenBuffers(); Then I need to install "glew".

By following the steps in here.

I download glew.zip from glew.sourceforge.net/ and unpack the files.

I put

  • glew.h in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
  • glew32.lib in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib, and
  • glew32.dll in C:\Windows\System32

After that, I build my project in VS 2010 and in Linker->input, I add dependencies glew32.lib.

But when I build it, I have an error:

unresolved external symbol __imp__glewInit
like image 655
NoviceCai Avatar asked Jan 17 '11 08:01

NoviceCai


1 Answers

Since it's not mentioned already, my problem was that I was linking against the static version of glew (glew32s.lib), but I hadn't defined the GLEW_STATIC preprocessor symbol (so the header I was compiling against effectively didn't match the library I was linking against).

like image 98
Cameron Avatar answered Sep 29 '22 18:09

Cameron