当前位置:网站首页>VSCode关于C语言的3个配置文件
VSCode关于C语言的3个配置文件
2022-07-07 15:40:00 【Larry Chow】
在cmd.exe中输入如下命令:
gcc -v -E -x c++ -
当用vscode打开文件夹,会自动创建.vscode文件夹,在该文件夹中,创建3个配置文件,分别是c_cpp_properties.json、launch.json、tasks.json。
将红框中的信息在配置文件中,做替换。
在c_cpp_properties.json中
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"D:/programFiles/MinGW/include/**",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++/mingw32",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++/backward",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/../../../../include",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include-fixed"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "",
"path": [
"${workspaceRoot}",
"D:/programFiles/MinGW/include/**",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++/mingw32",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include/c++/backward",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/../../../../include",
"D:/programFiles/MinGW/bin/../lib/gcc/mingw32/6.3.0/include-fixed"
]
}
}
],
"version": 4
}
在launch.json中
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "cmd",
"preLaunchTask": "echo",
"args": [
"/C",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"&",
"echo.",
"&",
"pause"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole":true
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files\\mingw64\\bin\\gdb.exe",// 自己电脑的gdb
"preLaunchTask": "echo",//这里和task.json的label相对应
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
在tasks.json中:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}.exe",
"-fexec-charset=GBK"//解决中文乱码
]
}
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
边栏推荐
猜你喜欢
99%的人都不知道|私有化部署还永久免费的即时通讯软件!
策略模式 - Unity
MRS离线数据分析:通过Flink作业处理OBS数据
Skimage learning (1)
【视频/音频数据处理】上海道宁为您带来Elecard下载、试用、教程
SIGGRAPH 2022最佳技术论文奖重磅出炉!北大陈宝权团队获荣誉提名
Linux 安装mysql8.X超详细图文教程
Sator launched Web3 game "satorspace" and launched hoobi
PLC:自动纠正数据集噪声,来洗洗数据集吧 | ICLR 2021 Spotlight
Devops' operational and commercial benefits Guide
随机推荐
Blue Bridge Cup final XOR conversion 100 points
SIGGRAPH 2022最佳技术论文奖重磅出炉!北大陈宝权团队获荣誉提名
DNS 系列(一):为什么更新了 DNS 记录不生效?
【可信计算】第十次课:TPM密码资源管理(二)
Problems encountered in Jenkins' release of H5 developed by uniapp
Solidity 开发环境搭建
智慧物流平台:让海外仓更聪明
L1-023 输出GPLT(Lua)
MRS离线数据分析:通过Flink作业处理OBS数据
Repair method of firewall system crash and file loss, material cost 0 yuan
【可信计算】第十二次课:TPM授权与会话
让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展
国内首创!Todesk将RTC技术融入远程桌面,画质更清晰操作更流畅
责任链模式 - Unity
centos7安装mysql笔记
The mail server is listed in the blacklist. How to unblock it quickly?
LeetCode 1049. Weight of the last stone II daily question
Notes on installing MySQL in centos7
Devops' operational and commercial benefits Guide
【饭谈】如何设计好一款测试平台?