i get this linker error with Dev-C++ when i do this:
[Linker error] undefined reference to `TextOutA@20'
Code:// This program shows the working of the WM_PAINT message #include <windows.h> LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); void Paint(HWND hwnd); int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hprevinst, LPSTR lpCmdLine, int cmdShow) { if (hprevinst == NULL) { WNDCLASS wclass; memset (&wclass, 0, sizeof(wclass)); wclass.style = CS_HREDRAW | CS_VREDRAW; wclass.lpfnWndProc = WndProc; wclass.hInstance = hinst; wclass.hCursor = LoadCursor (NULL, IDC_ARROW); wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wclass.lpszClassName = "BASIC2"; if (!RegisterClass (&wclass)) return 0; } HWND hwnd = CreateWindow("BASIC2", "The Title", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hinst, NULL); ShowWindow(hwnd, cmdShow); UpdateWindow(hwnd); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_DESTROY: PostQuitMessage(0); break; case WM_PAINT: Paint(hwnd); break; default: return DefWindowProc(hwnd, msg, wparam, lparam); } return 0; } void Paint(HWND hwnd) { PAINTSTRUCT ps; BeginPaint(hwnd, &ps); if (ps.hdc) { TextOut(ps.hdc, 10, 10, "Hello world", 11); EndPaint(hwnd, &ps); } }



LinkBack URL
About LinkBacks



