Search code examples
cwindowsopenglglew

linking to glew in c


I can't link properly to glew.

I have done:

#define GLEW_STATIC
#include "glew/glew.h"
#pragma comment(lib, "glew/glew32s.lib")

However, I still get the error:

LNK2019: unresolved external symbol __glewGenBuffersARB referenced in function initialize


Solution

  • Save yourself a lot of trouble and just put the glew.c file into your project. I never bother with linking to a glew library externally. Once you have that in there, the GLEW_STATIC macro will work. It's only one file, and (if this matters to you) it will carry nicely across platforms (rather than having to rebuild several OS-specific libs).