简体   繁体   English

我刚开始编码,但在 vscode 中出现了 undefined reference to winmain@16 这个错误

[英]I just started coding and I got this error undefined reference to winmain@16 in vscode

this is my code这是我的代码

#include<stdio.h>

int main()
{

    printf("I just started");
    return 0;
}

and this is the error这是错误

PS E:\coding> cd "e:\coding\" ; if ($?) { gcc tempCodeRunnerFile.c -o tempCodeRunnerFile } ; if ($?) { .\tempCodeRunnerFile }
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

The main issue is that "YOU DIDN'T save YOUR FILE", first save your cpp file then enter the command (g++ file.cpp) or run it.主要问题是“您没有保存您的文件”,首先保存您的 cpp 文件,然后输入命令 (g++ file.cpp) 或运行它。 Usually, this error occurs when file was not saved.通常,此错误发生在文件未保存时。

so click anywhere on your file and press ctrl+s to save it again, NOW YOUR ERROR GOT FIXXED, ......................所以单击文件上的任意位置并按 ctrl+s 再次保存它,现在您的错误已得到修复,......................

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM