【Visual Studio Code 】配置C语言环境
程序员文章站
2022-06-26 10:03:10
...
1、创建 c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "D:\\MinGW\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
2、创建launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe",
"preLaunchTask": "gcc",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
3、创建tasks.json
{
// 有关 tasks.json 格式的文档,请参见
// https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
//"type": "shell",这行要删除,不然会报错,文件路径不对
"label": "gcc",//与上面lauch.json的配置对应
"command": "D:\\MinGW\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "D:/MinGW/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
//这个是新增的,主要为了消除告警
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "new", //这里shared表示共享,改成new之后每个进程创建新的端口
"showReuseMessage": true,
"clear": false
}
}
]
}
备注:
使用VS code创建C语言程序时,先创建文件,再创建.txt文件,更改后缀名为.c,使用VScode打开即可开始写代码程序!!!
上一篇: 纯css3实现的竖形无限级导航
下一篇: PHP脚本监控程序
推荐阅读
-
Visual Studio怎么重新配置开发环境?
-
vim简单配置教程(vim配置c语言开发环境)
-
Opencv2.4.13与Visual Studio2013环境搭建配置教程
-
vim简单配置教程(vim配置c语言开发环境)
-
Visual Studio怎么重新配置开发环境?
-
再整理:Visual Studio Code(vscode)下的通用C语言环境搭建
-
Visual Studio Code (vscode) 配置 C / C++ 环境
-
Opencv2.4.13与Visual Studio2013环境搭建配置教程
-
从头开始学eShopOnContainers——Visual Studio 2017环境配置
-
使用 Visual Studio Code(VSCode)搭建简单的Python+Django开发环境的方法步骤