0

I first installed mingw into my system and added it to the path. It worked. Showing version when I type gcc --version in cmd. Then I reinstalled VS Code, then installed C/C++ Intellisense Extension and Code Runner Extension into the VS Code. After that, when I am writing even simple Hello World Programs, it is displaying an error as follows.

PS E:\C Programming> cd "e:\C Programming\" ; if ($?) { gcc hello-world.c -o hello-world } ; if ($?) { .\hello-world }
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(main.o):(.text.startup+0xc0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
PS E:\C Programming>

What does all this mean? How can this be fixed?

starball
  • 20,030
  • 7
  • 43
  • 238
  • 2
    You created a Windows GUI application (not a console application) and did not have a WinMain function. – drescherjm Oct 28 '20 at 13:42
  • 1
    Related: [https://stackoverflow.com/questions/20909816/undefined-reference-to-winmain16](https://stackoverflow.com/questions/20909816/undefined-reference-to-winmain16) – drescherjm Oct 28 '20 at 13:45
  • You probably need to show your `tasks.json` for someone to help – drescherjm Oct 28 '20 at 13:46

0 Answers0