I've been trying to install and learn use GLEW with SDL 2. I've been following this tutorial: http://headerphile.com/sdl2/opengl-part-1-sdl-opengl-awesome/
After linking all libraries and including all search directories, I'm getting the error undefined reference to `_imp__glewExperimental. I'm using Code::Blocks with GNU GCC Compiler.
Screenshots of my project build options:
search directories for the linker
search directories for compiler
linker
My code:
Things I've tried that haven't worked:
- Adding GLEW_STATIC before glew.h: This gives me an undefined reference to wglGetProcAddressed
- changing the order of linking glew32.lib and glew32s.lib I tried to manually link these two files using "Link Libraries" rather than -glew32 in "Other Linker Options" as shown in the screenshot. There is no difference regardless of what order I link them.
Not sure if it's worth mentioning or not but glewExperimental and glewGenBuffers are the only things that actually are undefined. glewInit() and other glew functions compiled fine with no problems.
If anyone can help me with this that'd be great.
Edit: I don't think this is a duplicate because all the other articles I've tried are either using some additional libraries (in which case their problems were that they didn't link all the libraries. I'm only using glew and I think I'm linking Glew correctly) or simply didn't solve my problem. Here are a list of articles I've tried:
- Can't compile easy source in C++ and OpenGL (GLFW) in Linux in NetBeans (Missing Linker Options)
- https://www.opengl.org/discussion_boards/showthread.php/176573-GLEW-Linking-Problem-%28C-%29
(Just didn't help, even though this guy had a seemingly similar problem. He only compiled with glew32s.lib but this didn't work for me)
Undefined reference to 'glewExperimental', 'glewInit@0', '__glewGenBuffers' (people didn't respond to this one)
GLEW Linker Errors (undefined reference to `__glewBindVertexArray') (Didn't help. This article said to put #define GLEW_STATIC in the source. That didn't work for me.
Linker error with glew when library is statically linked (Didn't work for me. I can't seem to find glew32sd which I assume I need if I'm working in debug mode and want to statically link glew32. This is the article that is supposed to be a duplicate of mine but it doesn't answer my question.)
If it helps at all, my project is in debug mode rather than release mode.