OpenGL/glew unresolved external symbols
Asked Answered
P

1

9

I am having issues with glew and linker errors. I have:

  1. put glew32.dll and glew32d.dll in system, System32 and SysWOW64
  2. put glew.h in GL folder
  3. put glew32.lib, glew32d.lib, glew32s.lib in Lib folder
  4. put glew32.lib, glew32d.lib, glew32s.lib, glut32.lib, opengl32.lib in Additional Dependencies
  5. put GLEW_STATIC in preprocessor defintions

However, I am still getting the following errors:

1>project2.obj : error LNK2001: unresolved external symbol ___glewGetProgramInfoLog
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetShaderInfoLog
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetProgramiv
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetShaderiv
1>project2.obj : error LNK2001: unresolved external symbol ___glewIsShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetUniformLocation
1>project2.obj : error LNK2001: unresolved external symbol ___glewLinkProgram
1>project2.obj : error LNK2001: unresolved external symbol ___glewAttachShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewCreateProgram
1>project2.obj : error LNK2001: unresolved external symbol ___glewCompileShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewShaderSource
1>project2.obj : error LNK2001: unresolved external symbol ___glewCreateShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewEnableVertexAttribArray
1>project2.obj : error LNK2001: unresolved external symbol ___glewVertexAttribPointer
1>project2.obj : error LNK2001: unresolved external symbol ___glewBufferData
1>project2.obj : error LNK2001: unresolved external symbol ___glewBindBuffer
1>project2.obj : error LNK2001: unresolved external symbol ___glewGenBuffers
1>project2.obj : error LNK2001: unresolved external symbol ___glewBindVertexArray
1>project2.obj : error LNK2001: unresolved external symbol ___glewGenVertexArrays
1>project2.obj : error LNK2001: unresolved external symbol ___glewUniformMatrix3fv
1>project2.obj : error LNK2001: unresolved external symbol ___glewUniformMatrix4fv
1>project2.obj : error LNK2001: unresolved external symbol ___glewUniform3f
1>project2.obj : error LNK2001: unresolved external symbol ___glewUniform1f
1>project2.obj : error LNK2001: unresolved external symbol ___glewUseProgram

Is there something obvious I am missing? Is there something else I can try? Thanks.

Propraetor answered 15/10, 2012 at 22:13 Comment(1)
I meet same errors cause I use x64's lib... FYI.Davis
B
0

If you're using the static library glew32s.lib you need to define the preprocessor flag GLEW_STATIC in order for you to resolve the symbols.

You can do this either in-source with

#define GLEW_STATIC

or add it to your pre-processor directives for the project

Project Properties > C/C++ > Preprocessor > Preprocessor Definitions

Image Showcasing Preprocessor  location, Location: Project Properties > C/C++ > Preprocessor > Preprocessor Definitions

If you still have unresolved external symbols afterwards you may also need to add opengl32.lib as an additional dependency for the linker.

If after that you are still having unresolved symbols regarding glew, make sure you actually have it's .lib added to a library directory that your linker searches in. You can add that in

Project Properties > Linker > General > Additional Library Directories

enter image description here

Biebel answered 8/12, 2021 at 4:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.