I'm working in a multiplatform project using OpenGL and get to the point where I needed to query the current context. In windows I used wglGetCurrentContext() including windows.h that worked fine.
On the other hand, when tried to compile in linux I'm using glXGetCurrentContext() and including glx.h which internally includes Xlib.h and X.h
It happens that in my source code I have a class called Status but there is a macro called the same in Xlib, i.e. #define Status int, Aha ! big problem now since I use my class everywhere.
What would be the best way to overcome this problem? The ideas I have in mind right now are
#pragma push_macro("Status")
followed by a #undef Status
If you have any other recommendation let me know, I appreaciate it very much.
at a bare minimum, you may isolate glXGetCurrentContext() into its own translation unit:
myGlXGetCurrentContext.hpp
GLUint myGlXGetCurrentContext();
myGlXGetCurrentContext.cpp
#include<glx.h>
GLUint myGlXGetCurrentContext(){ return glXGetCurrentContext(); }
whatever.hpp
#include<myGlXGetCurrentContext.hpp>
...