Glew in VS 2010: unresolved external symbol __imp__glewInit

后端 未结 5 1778
夕颜
夕颜 2020-12-15 19:40

I am learning OpenGL by following the redbook. When I come to around page 90, I need use glGenBuffers(); Then I need install \"glew\". By following the steps in www.cs.uiowa

相关标签:
5条回答
  • 2020-12-15 20:00

    Just as Hans Passant said earlier (He answered my question earlier but deleted the answer.)

    I need 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.

    0 讨论(0)
  • 2020-12-15 20:01

    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>
    
    0 讨论(0)
  • 2020-12-15 20:06

    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.

    0 讨论(0)
  • 2020-12-15 20:12

    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/

    0 讨论(0)
  • 2020-12-15 20:14

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

    0 讨论(0)
提交回复
热议问题