I'm creating a basic window, with the code below. I get the error: [Linker error] undefined reference to 'GetStockObject@4'
Can anyone help me through this? I have no idea what's up with this code..
Code:
#include <windows.h>
/* Message handler prototype */
LRESULT CALLBACK WndProc(HWND hWindow, UINT iMessage, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)
{
/* The Window Class */
WNDCLASS kWndClass;
/* 'Visual' properties */
kWndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
kWndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
kWndClass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
/* System properties */
kWndClass.hInstance = hInstance;
kWndClass.lpfnWndProc = WndProc;
kWndClass.lpszClassName = "01 Basic Window";
/* Extra properties */
kWndClass.lpszMenuName = NULL;
//kWndClass.cbClsExtra = NULL;
//kWndClass.cbWndExtra = NULL;
kWndClass.style = 0;
/* Try to register class */
if(!RegisterClass (&kWndClass))
{
return -1;
}
/* The Window */
HWND hWindow;
/* Create the window */
hWindow = CreateWindow("01 Basic Window", "A Blank Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
/* The Message Loop */
MSG kMessage;
/* Enter the message loop and deal with all the messages sent to our window */
while(GetMessage(&kMessage, hWindow, 0, 0))
{
TranslateMessage(&kMessage);
DispatchMessage(&kMessage);
}
return 0;
}
/* The Message Handler */
LRESULT CALLBACK WndProc(HWND hWindow, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
switch(iMessage)
{
case WM_CLOSE:
{
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hWindow, iMessage, wParam, lParam);
}
}