Alex319
Alex319

Reputation: 3918

GLEW and Freeglut won't work together?

I am trying to use geometry shaders in my OpenGL application that is currently using Freeglut, and I am trying to use GLEW to do that because as I understand it, the geometry shader functionality is in an extension. My include order is as follows:

   #define GLEW_STATIC
   #include <glew.h>
   #include "freeglut.h"

However when I do this I get lots of linker errors like the following:

   error LNK2001: unresolved external symbol ___glewAttachShader

I do not receive any errors when I only use the basic OpenGL functionality (that it, things that are not in the extensions) so I know that the compiler is finding all the "basic" libraries like glu32 etc. I am using Visual Studio 2008. Any suggestions?

Upvotes: 0

Views: 1680

Answers (1)

Bahbar
Bahbar

Reputation: 18015

It's a linker error that says it did not find a glew entrypoint.

Link against the glew library (you did not see the error before because you did not use any extension, I assume).

Edit: Actually, this is directly related to your usage of "GLEW_STATIC".

From the GLEW page:

On Windows, you also have the option of adding the supplied project file glew_static.dsp to your workspace (solution) and compile it together with your other projects. In this case you also need to change the GLEW_BUILD preprocessor constant to GLEW_STATIC when building a static library or executable, otherwise you get build errors.

What this says is that it is your responsibility to build and include the glew source files when you use the GLEW_STATIC setup.

Upvotes: 2

Related Questions