chris_rulez001 Posted July 4, 2007 Share Posted July 4, 2007 hi i know all there is to know about the basics of C++ but im struggling with this code, the problems: [Linker error] undefined reference to `TextOutA@20' ld returned 1 exit status Makefile.win [build Error] ["Windows] Error 1 the code: #include <windows.h> #define WIN32_LEAN_AND_MEAN LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); EndPaint(hWnd, &ps); switch (message) { case WM_CREATE: return 0; break; case WM_PAINT: TextOut(hdc,50,50,"Hello World", 0); break; case WM_DESTROY: PostQuitMessage(0); break; default: break; } return DefWindowProc(hWnd, message, wParam, lParam); } int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lCmdLine, int nCmdShow) { HWND hWnd = CreateWindow( "MyClass", "hello", WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_SYSMENU, 100, 100, 400, 400, NULL, NULL, hInstance, NULL); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } Quote Link to comment https://forums.phpfreaks.com/topic/58419-c-problems/ Share on other sites More sharing options...
fert Posted July 9, 2007 Share Posted July 9, 2007 looks like you're not linking the right libs Quote Link to comment https://forums.phpfreaks.com/topic/58419-c-problems/#findComment-293123 Share on other sites More sharing options...
chris_rulez001 Posted July 9, 2007 Author Share Posted July 9, 2007 ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/58419-c-problems/#findComment-293633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.