Link to home
Start Free TrialLog in
Avatar of DarkBlue
DarkBlue

asked on

OpenGL include file: multiple redefinitions of windows.h

Hello all,

I am trying to write an OpenGL application. I have different classes that need to use gl.h. Obviously windows.h has to be included before gl.h and that's causing me problems. This is what I have:

File 1:
#include <windows.h>
#include "GL/gl.h"
#include "GL/glu.h"
class A {
Render(); //in here I use gl stuff
}

File 2:
#include <windows.h>
#include "GL/gl.h"
#include "GL/glu.h"
class B {
Render(); //in here I use gl stuff
}

When compiling this I get the error message that MFC appc cannot use #include <windows.h>. I have a Win32 application by the way.
I have already tried #ifdef's and don't seem to work. Is there any way to get around this problem? Without rewriting all my classes if possible. I know that if I have one file that has all the gl stuff it will work but that will make everything a mess since I have over 15 files. Basically each file has an object of some kind that has it's own rendering function. The main rendering function calls the render function from each object.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of CBueche
CBueche
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial