1

My machine has OpenGL 2.0, for some weird reason, the header file gl.h does not contain shader functions. So, I was suggested to use GLEW. I installed GLEW properly, and have linked glew32s to my compiler, I have also included the header file in my main.cpp. Yet, I get compiler (not runtime) errors when simply calling:

 GLenum err = glewInit();

undefined reference to `imp_glewInit@0'

What in the world is that supposed to mean? It says similar things for shader functions.

I am using the GCC compiler, and am on windows x86.

Nick
  • 1,417
  • 1
  • 14
  • 21
Daniel Node.js
  • 6,734
  • 9
  • 35
  • 57
  • 2
    Are you `#define`ing `GLEW_STATIC` before `#include`ing `glew.h`? – genpfault Aug 17 '12 at 17:59
  • If you're on Windows and not using VC++, I think you have to build Glew with gcc then link to that. These two questions might help as well: http://stackoverflow.com/questions/7066673/installing-and-linking-glew-for-eclipse-cygwin-on-windows, http://stackoverflow.com/questions/11234386/compiling-simple-static-opengl-4-0-program-using-mingw-freeglut-and-glew – anthonyvd Aug 17 '12 at 18:05
  • @genpfault Wow. That's all that was missing. thanks! – Daniel Node.js Aug 17 '12 at 18:07
  • @pwny Are you sure about that? it seems to work fine now, thanks to genpfault's comment. – Daniel Node.js Aug 17 '12 at 18:07
  • @DantheMan Not sure at all, it was a (not so) educated guess. If it works now, all good for you :) – anthonyvd Aug 17 '12 at 18:08
  • @pwny Ah ok. I don't get any compiler errors, but I do get a crash when calling `glCreateShader(GL_VERTEX_SHADER);` I guess I should build a gcc version? – Daniel Node.js Aug 17 '12 at 18:18
  • @DantheMan I can't help that much without seeing the crash and fiddling a little but it seems to me that you'd be getting a compiler or linker error if that was the problem. Most likely your environment is set up properly and the problem is in code. – anthonyvd Aug 17 '12 at 18:35
  • I think you're right. I got it to work if I put it after certain initialization lines. Thanks for your help! – Daniel Node.js Aug 17 '12 at 18:39

1 Answers1

1

You're trying to use the static version of GLEW.

Make sure you #define GLEW_STATIC before #includeing glew.h.

genpfault
  • 51,148
  • 11
  • 85
  • 139