error C2146: syntax error : missing ';' before identifier 'g_App'
- by numerical25
I wish c++, was a little more specific on the messages they give. The following error is being thrown in the document below
main.h
#ifndef main_h
#define main_h
//includes
#include <windows.h>
#include <commctrl.h>
#include <d3d9.h>
#include <fstream>
#include "capplication.h"
//constants
#define TITLE "D3D Tut 01: Create Window"
#define WINDOW_X 350
#define WINDOW_Y 320
//Button ID's
#define ID_START 1
#define ID_CANCEL 2
//globals
extern CApplication g_App;
//function prototypes
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
#endif
The only header file that could possible throw this error is the capplication.h. given below
capplication.h
#ifndef capplication_h
#define capplication_h
#include"main.h"
class CApplication
{
public:
CApplication(void);
~CApplication(void);
void InitWindow(void);
void SaveSettings(void);
void LoadSettings(void);
void KillWindow(void);
inline bool GetWindowStatus(void)
{
return m_bRunningWindow;
}
inline HWND GetWindowHandle(void)
{
return m_hWindow;
}
inline void SetWindowStatus(bool bRunningWindow)
{
m_bRunningWindow = bRunningWindow;
}
private:
bool m_bRunningWindow;
HWND m_hWindow,
m_hBtnStart,
m_hBtnCancel,
m_hLblResolution,
m_hCbResolution,
m_hLblBackBuffer,
m_hCbBackBuffer,
m_hLblDepthStencil,
m_hCbDepthStencil,
m_hLblVertexProcessing,
m_hCbVertexProcessing,
m_hLblMultiSampling,
m_hCbMultiSampling,
m_hLblAnisotropy,
m_hCbAnisotropy;
DWORD m_dwWidth,
m_dwHeight,
m_dwVertexProcessing,
m_dwAnisotropy;
D3DFORMAT m_ColorFormat,
m_DepthStencilFormat;
D3DMULTISAMPLE_TYPE m_MultiSampling;
};
#endif
Besides that, the only suspicious thing I see is fstream given in the first code. I did have it as
fstream.h
But VC++ was not recognizing it so I was told to remove the h and I did. now I am down to this error. and I have no clue what it could be. Possibly something obvious