SFML community forums

Help => General => Topic started by: Kian on May 15, 2012, 04:30:46 pm

Title: #defines necessary for OpenGL
Post by: Kian on May 15, 2012, 04:30:46 pm
Not so much something I need help with but an oddity I was wondering if anyone else experienced, and if so how they dealt with it.

When I #include <SFML/OpenGL.hpp>, I need to add

#define GLAPI extern
#define APIENTRY

ahead of it.

This is only required once, but not having it causes conglicts in gl.h where there's a bunch of lines such as

GLAPI void APIENTRY functionname();

The preprocessor commands there seem to try to figure out the compiler and set defines for GLAPI and APIENTRY, but for some reason my MinGW installation isn't getting it right so I have to do it manually. But I'm not happy with sticking that there, knowing that if I try to rebuild the project elsewhere it's going to have to be removed.

I've tried to get it into the #define section of the project options, so it wouldn't sit in the code itself, but when I did I had the same problem as before, it complained that it could not recognize GLAPI and APIENTRY in gl.h.

Any ideas why this might be happening?

Using latest version of MinGW and Code::Blocks. I'm also including SFML/OpenGL.hpp ahead of SFML/Window.hpp and SFML/System.hpp, if that matters.