I have a static library in which I'm calling OpenGL extension functions via GLEW. As the project is being built in GCC (NetBeans 7.0), and GLEW's binaries are only shipped in Visual-C flavor, I have built GLEW (1.7.0) as a static library, with GCC. (I would also be interested why this is necessary, as GLEW seems to be pure C, in which ABI and cross-compiler compatibility isn't an issue AFAIK.)
In my static library I define GLEW_STATIC and NO_SDL_GLEXT as project preprocessor directives (-D), then I
#include "GL/glew.h"
#include "SDL/SDL.h"
The static library is then linked against in a (test) application, which also links against the following libraries, in the following order:
my_static_library
mingw32
glew32
opengl32
SDLmain
SDL
This setup gives me two undefined reference errors in my static library:
undefined reference to `_imp____glewGetStringi'
undefined reference to `_imp__glewInit'
Indeed, these are two calls made to GLEW functionality, in the static library. There are however other calls that the linker used to complain about (before -DGLEW_STATIC), yet seem to be ok now.
I wasn't able to improve the situation by swapping the order of linkage to opengl32 and glew32 (some more undef'd refs to wgl...
calls). Furthermore, GLEW_STATIC (and NO_SDL_GLEXT) used to be defined in the test application but that has been removed and doesn't seem to matter.
Why do the remaining errors occur and what can I do to get rid of them, i.e. how can I use GLEW in GCC with SDL?