关于vscode运行c程序时的问题
我是按照b站教程配置的vscode
其中在同一个文件夹下的联合文件可以正常运行
但是在同一文件夹下不相关的c程序就不能单独运行
请问是什么原因及解决方案
【相关推荐】
#include <stdio.h>
int main()
{
printf("hello world\n");
}
之后点击运行(安装vsCode插件Code Runner)报错
[Running] cd "f:\Space\CSpace\first\" && gcc hello.c -o hello && "f:\Space\CSpace\first\"hello
e:/apk/c/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: e:/apk/c/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
[Done] exited with code=1 in 0.232 seconds
解决方法:
VsCode点击运行–>添加配置,选中C++(Gcc/LLDW)–>接着选中gcc.exe…文件
之后点击运行即可