Vscode 编写并运行C程序

Vscode 编写并运行C程序

https://code.visualstudio.com/docs/languages/cpp

关于vscode

C++ is a compiled language meaning your program’s source code must be translated (compiled) before it can be run on your computer. C++是个编译型编程语言,意味着必须将源代码翻译才能被计算机运行 VS Code is first and foremost an editor, and relies on command-line tools to do much of the development workflow VS Code首先只是一个编辑器,依赖命令行工具来完成大部分开发工作流 The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer. C/C++扩展并不包含一个C++编译器或者调试器,你需要自己安装这些工具

确定已经安装好编译器和调试器

打开vscode,按Ctrl+`打开终端

GCC complier

g++ --version

Clang complier

若有信息输出,则已经配置完毕

没有安装MingW,百度搜索

Build C Program

选择 终端 > 运行生成任务(或者Ctrl+Shift+B)

选择gcc.exe build active file

然后就可以看见生成了对应的.exe文件

Run C Program

打开终端输入

.文件名
经验分享 程序员 微信小程序 职场和发展