I want to make GLEW work with CodeBlocks and have been trying to get
the first method presented on the site to work.
This is the method to compile glew statically into the executable.
But I haven’t managed to get it right.
I’m on a PC, Windows 7, running the CodeBlocks 10.05.
This is what I’ve done so far:
- Downloaded GLEW 1.7.0
- Unziped to C:
- Created empty project in CodeBlocks
- Moved glew.h, wglew.h and glew.c into my project source directory
- Added all of the three files to the project
-
Changed include path in glew.c for glew.h and wglew.h from
#include <GL/glew.h> #include <GL/wglew.h>to
#include "glew.h" #include "wglew.h" -
Created a simple main-file with the following code
#define GLEW_STATIC #include "glew.h" int main() { glewInit(); return 0; }
And with this the compilation will result in tons of warnings
and errors.
-
Errors such as:
glew.c|2933|undefined reference to `wglGetProcAddress@4'| glew.c|2934|undefined reference to `wglGetProcAddress@4'| glew.c|2935|undefined reference to `wglGetProcAddress@4'| glew.c|2936|undefined reference to `wglGetProcAddress@4'| -
Warnings such as:
glew.c|10050|warning: '__wglewReleaseVideoCaptureDeviceNV' redeclared without dllimport attribute: previous dllimport ignored| glew.c|10052|warning: '__wglewBindVideoImageNV' redeclared without dllimport attribute: previous dllimport ignored| glew.c|10053|warning: '__wglewGetVideoDeviceNV' redeclared without dllimport attribute: previous dllimport ignored| glew.c|10054|warning: '__wglewGetVideoInfoNV' redeclared without dllimport attribute: previous dllimport ignored| glew.c|10055|warning: '__wglewReleaseVideoDeviceNV' redeclared without dllimport attribute: previous dllimport ignored|
Where did I go wrong?
I would be happy to share more information if necessary!
You can eliminate those errors by linking your program with
opengl32and those warnings by definingGLEW_STATICalso in glew.c before the#includes.In any case your program won´t work because you need to have a valid OpenGL context before you can use
glewInit. You need to create one with glut/glfw/SDL/wglCreateContext/etc.