简体   繁体   English

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

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

This is what it looks like on VS code terminal when I run the code.这是我运行代码时在 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++> 

This is the simple program I tried to run.这是我尝试运行的简单程序。

#include<stdio.h>

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

screenshot of the program程序截图

save the file as said by @Gaurav Pathak and check if you've set the path to the compiler.按照@Gaurav Pathak 的说法保存文件,并检查您是否设置了编译器的路径。 and try gcc a.c -o a.exe for once.并尝试gcc a.c -o a.exe一次。 sometimes the code runner does something unexpected.有时代码运行器会做一些意想不到的事情。

暂无
暂无

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

相关问题 我无法在 vs 代码终端中运行 c 代码 - I'm not able to run c code in vs code terminal 我试图在 VS 中运行 c 的简单代码,但这表明,该怎么办? - I was trying to run a simple code of c in VS ,but this shows,what to do? 钩在终端上。 我可以在终端中运行命令之前调用方法吗? - Hooks on terminal. Can I call a method before a command is run in the terminal? 我正在尝试按升序将数字添加到链接列表中。 我该如何解决才能正常工作? 这是我的代码: - I'm trying to add numbers into a linked list in ascending order. what can I fix so it'll work? Here's my code: 我正在尝试制作一个可以根据用户在 C 中的选择运行不同功能的程序 - I'm trying to make a program that can run different functions depending on the user's choice in C 如何通过我的PC终端在我的Android设备上编译和运行C程序。 - How to compile and run a C program on my android device through my PC terminal.? 我正在尝试在 VS Code 中启用错误曲线,但它不起作用并抛出错误消息 - I'm trying to enable error squiggles in VS Code and it's not working and throwing an error message 这段代码有什么问题?。 几分钟前我刚刚学习了编程,我正在努力做到这一点 - What's wrong with this code?. I just learned programming a few minutes ago and I'm trying to make this C代码无法在mac Terminal中编译。 - C code won't compile in mac Terminal. 如何在 VSCode 内的终端中调试 c 代码? - How can I debugg c code in the terminal inside VSCode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM