Jump to content

Recommended Posts

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;
}

Link to comment
https://forums.phpfreaks.com/topic/58419-c-problems/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.