繁体   English   中英

我正在尝试在 VS 代码上运行 C,这就是终端上的内容。 我怎样才能解决这个问题?

[英]I'm trying to run C on VS code and this is what's on terminal. How can I fix this?

这是我运行代码时在 VS 代码终端上的样子。

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\C C++> cd "d:\C C++\" ; if ($?) { g++ TEST.C -o TEST } ; if ($?) { .\TEST }
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
PS D:\C C++> 

这是我尝试运行的简单程序。

#include<stdio.h>

int main(){
    int age;
    printf("Enter age\n");
    scanf("%d",&age);
    printf("age is %d",age);
    return 0;
}

程序截图

按照@Gaurav Pathak 的说法保存文件,并检查您是否设置了编译器的路径。 并尝试gcc a.c -o a.exe一次。 有时代码运行器会做一些意想不到的事情。

暂无
暂无

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

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