往下滑,选择 clang-x64 往下滑,选择 c17、c++17 配置完了 查看配置文件 ./vscode/c_cpp_properties.json {"configurations":[{"name":"Mac","includePath":["${workspaceFolder}/**"],"defines":[],"macFrameworkPath":["/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"],...
我们按 ctrl + ,进入设置(ctrl + 逗号)或者点击文件 -> 首选项 -> 设置 问题2:run code执行代码出现gcc(或g++) :error; no such file or directory的错误 原因分析 这个错误可能是编译命令执行前没有进入指定的文件夹前导致的,所以我们加一个cd 目标文件夹路径即可 解决办法 第一步 打开code runner扩展设置...
"compilerPath": "D:\\msys64\\ucrt64\bin\\g++.exe", //更换成自己安装的g++的路径 "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 } 然后重启vscode,即可设置成功。 4 调试(Debug)C/C++代码 新建一个helloworld.cpp文件,输入一下内容...
{ "configurations": [ // c的相关配置 { "name": "Win32_C", // 配置名称 "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "D:\\Program Files (x86)\\mingw64\\bin\\gcc.exe", // 编译器路径 "cStandard": "c17",...
vscode 的默认语法检查规则还是 C++14。还需要把语法检查规则改成 C++17 的才行。 同时按住 shift + Ctrl + p 出现搜索框,在搜索框中输入 C/C++, 选择 “编辑配置文件(JSON)” 下面也有对应的英文版的显示。按下图设置成 “cStandard”: “gnu17”, “cppStandard”: “gnu++17”, 改完后保存,回到 C++...
"cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "gcc-x64" } ], "version": 4 } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 注意compilerPath这一项要把路径改成刚才g++的安装路径:找到刚刚的安装文件夹->MinGW->bin->g++,exe ,然后复制或者手动把...
{workspaceFolder}/**"], "defines": ["_DEBUG", "UNICODE", "_UNICODE"], "windowsSdkVersion": "10.0.18362.0", "compilerPath": "C:/MinGW-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/g++.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "gcc-x64"...
"cStandard": "c17", "cppStandard": "c++17", "compilerPath": "D:/mingw64/bin/g++.exe", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 } 截图如下: compilepath换成自己的目录 之后创建一个settings.json { "C_Cpp.errorSquiggles": "Enabled", ...
//c_cpp_properties.json{"configurations": [{"name": "Win32","includePath": ["${workspaceFolder}/**"],"defines": ["_DEBUG","UNICODE","_UNICODE"],"windowsSdkVersion": "10.0.22621.0","compilerPath": "C:/mingw64/bin/gcc.exe","cStandard": "c17","cppStandard": "c++17","intelliSen...
"cStandard": "c17", "cppStandard": "gnu++14", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 } (2).配置构建任务 接下来,创建一个tasks.json文件来告诉VS Code如何构建( 编译)程序。该任务将调用g++编译器基于源代码创建可执行文件。 按快捷键Ctrl+Shift+P调出命令面板,输入tasks,选择...