//Registration of class
if(!RegisterClassEx(&wcl))
return 0;
//Create Window
hwnd = CreateWindow(
szWinName,
szTitle,
WS_OVERLAPPEDWINDOW|WS_SYSMENU,// no scroll bar
CW_USEDEFAULT,
CW_USEDEFAULT,
400, // specific value instead of CW_USEDEFAULT
300, // specific value instead of CW_USEDEFAULT
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);
//Code listing for WMain.cpp
include <windows.h></windows.h>
extern LRESULT CALLBACK WindowF (HWND,UINT,WPARAM,LPARAM);
char szWinName[] = "MyWin";
char szTitle[] = "Parabola Drawing";
int WINAPI WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
{
//Defining window class
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;
wcl.cbClsExtra = 0;//extra bytes
wcl.cbSize = sizeof(WNDCLASSEX); //size of the struct
wcl.cbWndExtra = 0;//extra bytes
wcl.hbrBackground = (HBRUSH)GetStockObject(WHITEBRUSH);
wcl.hCursor = LoadCursor(NULL,IDC_ARROW);
wcl.hIcon = LoadIcon(NULL,IDI_WINLOGO);
wcl.hIconSm = NULL;
wcl.hInstance = hThisInst;
wcl.lpfnWndProc = WindowF;
wcl.lpszClassName = szWinName;
wcl.lpszMenuName = "MyMenu";
wcl.style = 0;
//Registration of class
if(!RegisterClassEx(&wcl))
return 0;
//Create Window
hwnd = CreateWindow(
szWinName,
szTitle,
WS_OVERLAPPEDWINDOW|WS_SYSMENU,// no scroll bar
CW_USEDEFAULT,
CW_USEDEFAULT,
400, // specific value instead of CW_USEDEFAULT
300, // specific value instead of CW_USEDEFAULT
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);
ShowWindow(hwnd, SW_RESTORE);
UpdateWindow(hwnd);
//Serve Messages
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}//end while
return msg.wParam;
}//end WinMain****
the above is code im trying to compile on dev c++ but it says following
> Compiling single file...
Processing C++ source file...
C:\Users\SHAILE~1\AppData\Local\Temp\ccRh648e.o: In function
WinMain': E:/study/sem7/graphics lab/P4_2_Ellipse/WMain.cpp:19: undefined reference to
imp_GetStockObject'C:\Users\SHAILE~1\AppData\Local\Temp\ccRh648e.o:WMain.cpp:(.rdata$.refptr._Z7WindowFP6HWNDjyx[.refptr._Z7WindowFP6HWND__jyx]+0x0): undefined reference to `WindowF(HWND__*, unsigned int, unsigned long long, long long)'
collect2.exe: error: ld returned 1 exit status
Compilation results...
the code compiles and runs fine in codeblocks
the problem is with line " wcl.hbrBackground = (HBRUSH)GetStockObject(WHITEBRUSH);"
but how to resolve it please help me .