Why am I getting error LNK1104: cannot open file 'glew32.lib'

mireazma picture mireazma · Feb 14, 2015 · Viewed 16.3k times · Source

I've already read many answers that wanted to solve this issue but none of them work. I don't think I'm missing anything:

  • Visual Studio 2013 Community Edition
  • Target = all configurations, all platforms (active = debug, Win32)
  • C/C++ > General > Additional Include Directories: H:\#DEV\OpenGL\glew-1.12.0\include
  • Linker > General > Additional Library Directories: H:\#DEV\OpenGL\glew-1.12.0\lib
  • Linker > Input > Additional Dependencies: glew32s.lib (I also tried glew32.lib)
  • Path of both files library files (glew32.lib and glew32s.lib): H:\#DEV\OpenGL\glew-1.12.0\lib\Release\Win32.

I have permission to access the file, I didn't specify a dll since I want to use only the static version. I also tried:

#define GLEW_STATIC

before #include and #pragma comment(linker, "/NODEFAULTLIB:libc.lib") to no avail.

Answer

Axalo picture Axalo · Feb 14, 2015

Visual Studio doesn't look into the subfolders of the directories you specified in
Additional Library Directories.

That means that you have to add the exact path where the library is stored
(which would be in your case H:\#DEV\OpenGL\glew-1.12.0\lib\Release\Win32).