My subject may be a bit confusing, but it's correct. I have what i would a call a hierarchy of header files, all with classes that support classes up the line, and I'm having some difficulty with the information being passed down.
I am working on a small direct 3d application. The code is split up, where i have a header file called Engine.h, and then for right now, 2 headers that are included in it, Input.h and Graphics.h . At the top of Engine.h I have this entry:
#include <Windows.h>
#include "Graphics.h"
#include "Input.h"
Now the weird thing is here, in the class i have defined in Input.h , it is able to use windows types just fine, namely
HWND
, but for some reason i get an error about missing types when trying to use HWND in my Graphics.h file. here is that file:
#ifndef GRAPHICSCLASS
#define GRAPHICSCLASS
const bool VSYNC_DEPTH = true;
const float SCREEN_DEPTH = 1000.0f;
const float SCREEN_NEAR = 0.1f;
class GraphicsClass
{
public:
GraphicsClass();
~GraphicsClass();
bool Initialize(int, int, HWND);
void Shutdown();
bool Frame();
private:
bool Render();
private:
};
#endif
The error I receive when attempting to compile this is exactly as follows:
1>------ Build started: Project: engine, Configuration: Debug Win32 ------
1> Graphics.cpp
1>c:\users\wyatt\documents\visual studio 2010\projects\engine\engine\graphics.h(15): error C2061: syntax error : identifier 'HWND'
1>c:\users\wyatt\documents\visual studio 2010\projects\engine\engine\graphics.cpp(14): error C2061: syntax error : identifier 'HWND'
1> Generating Code...
1> Compiling...
1> Engine.cpp
1> Generating Code...
1> Compiling...
1> EntryPoint.cpp
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I just assume that this error has to do with it not finding the
HWND
type, but could it be something else? any help would be appreciated. BTW, MSVC++ express.
EDIT: Here is the Input.h file:
Input.h
#ifndef _INPUTCLASS_H_
#define _INPUTCLASS_H_
#define DIRECTINPUT_VERSION 0x0800
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#include <dinput.h>
class InputClass
{
public:
InputClass();
~InputClass();
bool Initialize(HINSTANCE, HWND, int, int);
void Shutdown();
bool Frame();
bool IsEscapePressed();
void GetMouseLocation(int &, int &);
private:
bool ReadKeyboard();
bool ReadMouse();
void ProcessInput();
private:
IDirectInput8* m_directInput;
IDirectInputDevice8* m_keyboard;
IDirectInputDevice8* m_mouse;
unsigned char m_keyboardState[256];
DIMOUSESTATE m_mouseState;
int m_screenWidth, m_screenHeight;
int m_mouseX, m_mouseY;
};
#endif