0
#include<stdio.h> 

int main() {      

    printf("my name is Lakpa Titung");     
    return 0;      
}
Windows PowerShell Copyright (C) Microsoft Corporation. All rights
reserved.

Install the latest PowerShell for new features and improvements!
https://aka.ms/PSWindows

PS C:\Users\user\C programming> gcc coading.c
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
PS C:\Users\user\C programming> ./a.exe
./a.exe : The term './a.exe' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At line:1 char:1
+ ./a.exe
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (./a.exe:String) [], CommandNotFoundException       
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\user\C programming> 
MikeCAT
  • 73,922
  • 11
  • 45
  • 70
  • https://stackoverflow.com/questions/58324230/undefined-reference-to-winmain-c-mingw – Andro Jul 21 '22 at 12:23
  • To be portable, the minimum signature for `main` is `int main(void) {... return 0; }`. Other than that there is nothing you've show that should not compile. – ryyker Jul 21 '22 at 12:32
  • 2
    Does this answer your question? [Undefined reference to WinMain (C++ MinGW)](https://stackoverflow.com/questions/58324230/undefined-reference-to-winmain-c-mingw) – the busybee Jul 21 '22 at 12:52

1 Answers1

0

your code is totally right but at compile time it shows the error like: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

then go to: setting-extension-Run code configuration- Click on Run in terminal and also click on Save befor Run....

your setting has done. Rerun your code.

Karan Pal
  • 1
  • 1