简体   繁体   English

如何在 Visual Studio Code 中编译 C 程序?

[英]How to compile C program in Visual Studio Code?

I installed VSC and wrote this program我安装了 VSC 并编写了这个程序

#include <stdio.h>

int main( void )
{
    printf("Hello world!");
}

Then I installed a C/C++ debugger and I saved the file on the desktop as "hello.c" and magically the syntax became higlighted.然后我安装了一个 C/C++ 调试器,并将文件保存在桌面上,名为“hello.c”,语法神奇地高亮显示了。

Now I would like to run the program, but can't find a way.现在我想运行程序,但找不到方法。
There's no "run" or "build" option anywhere, and if I start the debugging and choose the debugger then I got a new tab named "settings.json" with a couple of brackets waiting for me to write something.任何地方都没有“运行”或“构建”选项,如果我开始调试并选择调试器,那么我会得到一个名为“settings.json”的新选项卡,其中有几个括号等着我写东西。

Also in the left I can read that I "have not yet opened a folder".同样在左侧,我可以看到我“尚未打开文件夹”。 What does it even mean?这到底是什么意思?

And the line #include <stdio.h> is underlined in red, like there's something wrong going on, maybe I have to download the library? #include <stdio.h>行带有红色下划线,好像出了什么问题,也许我必须下载库?

I would do anything to see the output of the program, please help me.想看看output的程序,请大家帮帮我。

have you added c/c++ and code runner extensions?您是否添加了 c/c++ 和代码运行程序扩展?

I installed VSC and wrote this program我安装了 VSC 并编写了这个程序

#include <stdio.h>

int main( void )
{
    printf("Hello world!");
}

Then I installed a C/C++ debugger and I saved the file on the desktop as "hello.c" and magically the syntax became higlighted.然后我安装了一个 C/C++ 调试器,并将文件保存在桌面上作为“hello.c”,神奇地语法变得高亮。

Now I would like to run the program, but can't find a way.现在我想运行该程序,但找不到方法。
There's no "run" or "build" option anywhere, and if I start the debugging and choose the debugger then I got a new tab named "settings.json" with a couple of brackets waiting for me to write something.任何地方都没有“运行”或“构建”选项,如果我开始调试并选择调试器,那么我会得到一个名为“settings.json”的新选项卡,其中有几个括号等着我写点什么。

Also in the left I can read that I "have not yet opened a folder".同样在左侧,我可以看到我“尚未打开文件夹”。 What does it even mean?它甚至意味着什么?

And the line #include <stdio.h> is underlined in red, like there's something wrong going on, maybe I have to download the library? #include <stdio.h>行用红色下划线,好像有什么问题,也许我必须下载库?

I would do anything to see the output of the program, please help me.我会做任何事情来查看程序的output,请帮助我。

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

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