c_cpp_properties.json - 编译环境相关的设置
该文件用于指定一般的编译环境,包括头文件路径,编译器的路径等。通过 Ctrl + Shift + p 打开命令行,键入关键字 "C++",在下拉菜单中选择 "C/C++ Edit configuration",系统即自动在 .vscode 目录下创建 c_cpp_properties.json 文件,供用户进行编译方面的环境配置。
windows默认配置:
{
"configurations": [
{
"name": "Win32", //环境名
"includePath": [
"${workspaceFolder}/**" //指定头文件路径,这里指定的是当前工作目录,如有需要在后面添加,添加方式是加入 "/to/path" 格式的路径
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "D:\\Program Files (x86)\\mingw64\\bin\\gcc.exe", //编译器的路径,可根据自己的安装情况进行设置
"cStandard": "gnu17",
"cppStandard": "gnu++14", //设置使用的 C/C++ 标准
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
linux默认配置:
{
"configurations": [
{
"name": "Linux", //环境名
"includePath": [
"${workspaceFolder}/**" //指定头文件路径,这里指定的是当前工作目录,如有需要在后面添加,添加方式是加入 "/to/path" 格式的路径
],
"defines": [],
"compilerPath": "/usr/bin/g++", //编译器的路径,可根据自己的安装情况进行设置
"cStandard": "c11",
"cppStandard