Vs code error outputting C code

I’m a totally beginner. I wanted compile c through MinGW in Visual Studio Code, but I got an error code at terminal in Visual Studio Code. At first, I created a file just under Windows(c:). Please help me!
//code

#include <stdio.h>

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

//Terminal

PS C:\vscode> gcc hello.c ingw32/bin/ld.exe: c:/mingw/bin/…/lib/gcc/mingw32/8.2.0/…/…/…/libmingw32.a(main.o):(c:/mingw/bin/…/lib/gcc/mingw32/8.2.0/…/…/…/…/mn@16’ingw32/bin/ld.exe: c:/mingw/bin/…/lib/gcc/mingw32/8.2.0/…/…/…/libmingw32.a(main.o):(.text.startup+0xb0): undefined reference to `WinMain@16’ collect2.exe: error: ld returned 1 exit status

My best guess is that there is a problem with how MinGW was setup. It could be an incorrect version, missing additional packages, incorrect integration with VSCode…etc. I haven’t worked through that specific issue, so I don’t know.
FWIW, when I’m on a Windows computer I tend to use WSL for C/C++ because I get annoyed trying to get the compilers integrated correctly and WSL is an an easy solution to that.

1 Like