Search code examples
cwindowstcc

tcc: undefined symbol '_MessageBoxA@16' error on my c code


I tried to include <windows.h> with also <stdio.h> but it shows: tcc: undefined symbol '_MessageBoxA@16' when i use my only Pocket Edition TinyCCompiler. does anybody know why?

#include <stdio.h>
#include <winapi/windows.h>
#include <winapi/winuser.h>
/* ooops fell of my chair */
int main()
{
   char name[40];
   char age[6];
   printf("Enter name:");
   scanf("%39s", name);
   printf("\n");
   printf("Enter age:");
   scanf("%5s", age);
   printf("\n");
   printf("You: Hello my name is %s, and i'm %s years old.",name,age);
   printf("\n----------------OTHER PROGRAM----------");
   MessageBox(0, "Hello", "Hellodd", 1);
   return 0;
}

Solution

  • You need to link with user32:

    tcc -Wall code.c -luser32