TCC Compiler: Undefined symbol “main”

Two errors:

  1. The hello_data variable is declared extern which means it is not defined in this program module so needs to come from somewhere else, from somewhere else that is linked in at the same time.
  2. Your WinMain routine calls the hello_func but it is not defined. In C, when you see the definition ending with (); that means this is a prototype to tell the compiler what to expect, not the actual code for the function.

I would suggest that to start, you plan on getting a console type application going to start, such as the infamous hello world, something like:

#include <stdio.h>
int main()
{
    printf("Hello William\n");
}

This would be compiled and run in a cmd window under MS Windows. When you get that working, you can look into doing something fancier using the windows environment and things like WinMain in a DLL.

Leave a Comment