Delectable Goat
Delectable Goat

Reputation: 31

fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory

I am attempting to statically link GLEW to Visual Studio 2017. I followed a video tutorial exactly, but I still got an error:

fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory

I have no idea what could be causing it. Here are the steps I took to link GLEW:

  1. Put the folder named GLEW into a folder called dependencies in the solution directory
  2. Went to C/C++, General and under "Additional Include Directories," I added $(SolutionDir)Dependencies\GLEW\include, which, when I go to edit, evaluates to the correct path
  3. Went to Linker, General and under "Additional Library Directories," I added $(SolutionDir)Dependencies\GLEW\lib\Release\Win32, which also evaluates to the correct path
  4. Went to Linker, Input and under "Additional Dependencies," I added glew32s.lib
  5. Finally, I went to C/C++, Preprocessor and under "Preprocessor Definitions," I added GLEW_STATIC

I also did this same process with GLFW, and it worked perfectly, so I have no idea what the problem could be. I have checked and doublechecked the paths, so I am fairly certain that they are correct.

Upvotes: 1

Views: 5120

Answers (2)

SoMZeY
SoMZeY

Reputation: 7

I've encountered a related issue at the beginning of my Visual Studio journey.

I had two projects in one solution: let's call them Core and App. I linked GLEW in Core and linked Core in App. My intuition was that the dependencies would follow Core, but this was not the case. You need to link GLEW in all the projects that use it, or alternatively, use the less common approach of making Core "expose" GLEW to App.

Lesson: Static Libraries Do Not Propagate Dependencies If you have multiple projects in your solution that use the same libraries, double-check that you link them in each project.

Related Info: GitHub

Upvotes: 0

Figwig
Figwig

Reputation: 632

Sounds like you're doing

#include <GL/glew.h>

When you should be doing

#include <glew.h>

Is glew.h directly in the win32 folder? Or is there a further "GL" folder?

Upvotes: 0

Related Questions