Building the program worked just fine, but when I try out its debug .exe, I get an error message that says "The variable 'msg' is being used without being initialized."
#include "main.h"
//this is a class that initializes the window
Application g_App;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
//show window
g_App.PostWindowToScreen(g_App.GetWindowHandle(), nCmdShow);
//needed in the main loop
MSG msg;
//enter the main loop
while(g_App.GetWindowStatus()) //the test for this while loop is there to make sure that the window hasn't been exited
{
// Check to see if any messages are waiting in the queue
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// translate keystroke messages into the right format
TranslateMessage(&msg);
// send the message to the WindowProc function
DispatchMessage(&msg);
}
// If the message is WM_QUIT, exit the while loop
if(msg.message == WM_QUIT)
break;
// Run game code here
// ...
// ...
}
// return this part of the WM_QUIT message to Windows
return msg.wParam;
};