kbirk
kbirk

Reputation: 4022

Including glew using only source files?

For reasons outside of my comprehension, glew will simply not work when statically linked. Is there a way to simply just include the glew.h, glxew.h, wglew.h and glew.c source files into my project and use

#include "glew.h"

instead of

#include <glew.h>

whenever i try i get an explosion of warnings: like

warning C4273: '__WGLEW_NV_render_depth_texture' : inconsistent dll linkage

Upvotes: 3

Views: 9303

Answers (2)

Gnawme
Gnawme

Reputation: 2389

From the GLEW Installation page:

"On Windows, you also need to define the GLEW_STATIC preprocessor token when building a static library or executable, and the GLEW_BUILD preprocessor token when building a dll. You also need to replace and with in your code and set the appropriate include flag (-I) to tell the compiler where to look for it."

Upvotes: 3

Mikola
Mikola

Reputation: 9326

Have you seen the GLEW installation/building page?

http://glew.sourceforge.net/install.html

If you are building it statically (which it sounds like you are), you need to define the GLEW_STATIC macro before include glew.h (or else it won't compile). The easiest way to do this is to add an option to your project; or if you are stubborn you could just do this:

 #define GLEW_STATIC
 #include "glew.h"

Upvotes: 12

Related Questions