I'm using Visual Studio 2010.
I'm trying to write simple Camera class in OpenGL.
I need to include gl/gl.h in Camera.h
gl/gl.h is already included in main.cpp and Camera.h is included in main.cpp
When I put
#include <gl/gl.h>
in Camera.h i got bunch of errors like this one:
Error 11 error C2086: 'int APIENTRY' : redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\gl\GL.h 1153 1 Gaz 3D
files:
Camera.h
#include <math.h>
#include <gl/gl.h>
#ifndef _CAMERA_H
#define _CAMERA_H
class Camera
{
private:
Camera();
public:
static Camera& getCamera();
float x, y, z, rotv, roth;
void moveForward(float n);
void moveBackward(float n);
void moveLeft(float n);
void moveRight(float n);
void lookUp(float n);
void lookDown(float n);
void lookLeft(float n);
void lookRight(float n);
};
#endif
main.cpp:
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <math.h>
#include "Camera.h"
// ... some variables ...
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
// main code ...
}
What am I doing wrong?
#include <math.h>
and#include <gl/gl.h>
should be inside of the#ifndef
guard in Camera.h. On second thought, you don't even need those includes in that header at all; you aren't using anything from them in the declaration of Camera. – Cathcart