Glew in VS 2010: unresolved external symbol __imp__glewInit
Asked Answered
Y

5

18

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
Yolondayon answered 17/1, 2011 at 8:5 Comment(0)
Y
8

I need to compile the source code of glew.

How to compile it, see: OpenGL: How to compile glew32.dll from source file.

Then you will get glew32d.dll and glew32d.lib.

  • Put glew32d.dll in c:\windows\sysWOW64 (I also put it in system and system32).
  • Put glew32d.lib in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
  • Put glew.h in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

Then it will work.

Yolondayon answered 17/1, 2011 at 19:14 Comment(3)
I spend two days to figure this out with the help from Hans Passant and Mark.Yolondayon
I had the same problem. I started again from the scratch with this manual and it worked: 3dgraphicsfoundations.com/visstudio.htmlWaterlogged
@abimelex , thanks for posting the link, i had forgotten the step to define additional dependencies in VS, was driving me nutsPalaeontology
C
46

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).

Chrysolite answered 20/1, 2013 at 6:43 Comment(0)
Y
8

I need to compile the source code of glew.

How to compile it, see: OpenGL: How to compile glew32.dll from source file.

Then you will get glew32d.dll and glew32d.lib.

  • Put glew32d.dll in c:\windows\sysWOW64 (I also put it in system and system32).
  • Put glew32d.lib in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
  • Put glew.h in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

Then it will work.

Yolondayon answered 17/1, 2011 at 19:14 Comment(3)
I spend two days to figure this out with the help from Hans Passant and Mark.Yolondayon
I had the same problem. I started again from the scratch with this manual and it worked: 3dgraphicsfoundations.com/visstudio.htmlWaterlogged
@abimelex , thanks for posting the link, i had forgotten the step to define additional dependencies in VS, was driving me nutsPalaeontology
K
6

Another possible solution and less work than compiling the dll from source, is to just use the 32 bit binaries. Windows 7 64bit just doesn't want to co-operate with the 64 bit binaries that they currently have available.

Here's a pretty general setup guide if anyone needs. http://openglbook.com/setting-up-opengl-glew-and-freeglut-in-visual-c/

Kabuki answered 28/3, 2012 at 5:34 Comment(1)
Broken link (404)Pithos
M
2

I struggled with this too for a few hours. Then I realized my program is win32 instead of x64. I was including the glew.lib under the x64 folder when I should be using the glew.lib under the win32 folder.

Meshed answered 19/4, 2015 at 9:34 Comment(0)
S
1

Also make sure you add the proper include for it. I did all the crazy library stuff and somehow forgot to actually include the header file.

In my case it was:

#include <GL/glew.h>
Sought answered 3/10, 2011 at 5:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.