itz Prateek
itz Prateek

Reputation: 101

undefined reference to `WinMain@16' error

Getting error: c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status

while compiling a simple c program in Virtual Studio Code.

My Code:

#include <stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

I have also installed mingw software even i have give the environment variable. Still getting this error.

Upvotes: 1

Views: 2289

Answers (1)

Afshin
Afshin

Reputation: 9173

You have created an application with type of Windows Application. Create a Console Application or change type of current application to console one.

Upvotes: 1

Related Questions