1

I'm very new at coding. I dowloaded VSCode to practice C.`I copied a line of code from the internet, the "Hello World". As I try to run it, my terminal shows this:

none C:\Users\Selene_514\Desktop\C CPP>cd "c:\Users\Selene_514\Desktop\C CPP" && gcc hello.c -o hello && "c:\Users\Selene_514\Desktop\C CPP"hello 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.

I installed MinGW and changed the environment path properly. What should I do?

enter image description here

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • This is not really a C question. Your code is ok; though I'd use `puts()` rather than `printf()` in this particular occasion. – pmg Nov 04 '20 at 08:43
  • 3
    Probably you created a Windows/GUI project when you should have created a console one. This particular IDE seems a bit dysfunctional when it comes to describing what exactly the various types of projects contain in detail. – Lundin Nov 04 '20 at 08:51
  • search SO because this error pops up every few days – rioV8 Nov 04 '20 at 10:01
  • Does this answer your question? [undefined reference to \`WinMain@16'](https://stackoverflow.com/questions/5259714/undefined-reference-to-winmain16) – the busybee Nov 04 '20 at 14:57

0 Answers0