Jump to content

C++ problems


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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.