0

I am trying to learn how to write shader code in OpenGL. I installed all the necessary components such as GLUT and added GLee.h to my project. However, I am getting an error in Visual Studio 2013 that states that the file glx.h cannot be located. Here's where in the GLee.h code this happens:

#ifdef WIN32
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <GL/gl.h>
#elif defined(__APPLE__) || defined(__APPLE_CC__)
    #define GL_GLEXT_LEGACY
    #include <OpenGL/gl.h>
#else // GLX
    #define __glext_h_  /* prevent glext.h from being included  */
    #define __glxext_h_ /* prevent glxext.h from being included */
    #define GLX_GLXEXT_PROTOTYPES
    #include <GL/gl.h>
    #include <GL/glx.h>
#endif

I don't understand why that last line shows up as something that needs to be included in the first place since I am running win7. Even though my operating system is 64-bit the Visual Studio 2013 version is 32-bit so it would make sense that VS2013 should recognize the #ifdef WIN32 and run that code, but it doesn't. I tried downloading the asked for files but then VS2013 just asked for more, after a few files I gave up that strategy. I tried Googling for this answer and couldn't find anything to fix the issue which was strange because I would think this would be a common occurrence if it is a problem with VS2013. Any ideas how to fix this?

Urler
  • 500
  • 3
  • 8
  • 23

2 Answers2

1

The first line is wrong.

Simply add an underscore to WIN32 like so:

#ifdef _WIN32 

EDIT: Just on a side note, I would recommend using GLEW over GLee. GLee doesn't seem to be actively updated these days, and (according to their SourceForge page), only supports up to OpenGL 3.0. Whereas GLFW is regularly updated, and supports everything up to OpenGL 4.5.

K_Finlay
  • 523
  • 3
  • 15
0

Apparently Visual Studio defines _WIN32 but not WIN32. MinGW defines both WIN32 and _WIN32. If all else fails, you can define WIN32. See this question for more information.

Community
  • 1
  • 1
programmerjake
  • 1,794
  • 11
  • 15