visual studio code
时间: 2023-10-03 20:06:49 浏览: 113
Visual Studio Code(简称VS Code)是一款由微软开发的免费开源的轻量级代码编辑器。它支持多种编程语言,包括C/C++。在Windows环境下,如果你想使用VS Code来编写C/C++程序,你需要下载并安装GCC等相关工具(如WinGw)来提供支持,因为VS Code本身并不支持C语言的调试和编译。
下面是运行一个简单的C程序(Hello World)的步骤:
1. 首先,确保你已经安装了VS Code和GCC等工具。
2. 打开VS Code,创建一个新的文件,并将以下代码复制到文件中:
```c
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}
```
3. 将文件保存为以.c为后缀的文件(例如hello.c)。
4. 打开命令行终端,进入保存文件的目录。
5. 使用以下命令编译C程序:
```
gcc hello.c -o hello
```
6. 编译成功后,会生成一个可执行文件hello.exe。
7. 在命令行终端中运行可执行文件:
```
hello.exe
```
8. 程序将输出"Hello World"。
阅读全文
相关推荐








