关于vscode配置C/C++的配置文件问题
2022/2/5 17:13:59
本文主要是介绍关于vscode配置C/C++的配置文件问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "D:\\code\\MinGW\\bin\\g++.exe", "cStandard": "gnu17", "cppStandard": "gnu++14", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 }
launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "g++.exe - 生成和调试活动文件", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "D:\\code\\MinGW\\bin\\gdb.exe", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++.exe 生成活动文件 ver(1)" } ] }
settings.json
{ "C_Cpp.errorSquiggles": "Disabled", "files.associations": { "ostream": "cpp", "iostream": "cpp", "random": "cpp" } }
tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe 生成活动文件", "command": "D:\\code\\MinGW\\bin\\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${workspaceFolder}/build/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": "build", "detail": "编译器: D:\\code\\MinGW\\bin\\g++.exe" }, { "type": "cppbuild", "label": "C/C++: g++.exe 生成活动文件 ver(1)", "command": "D:\\code\\MinGW\\bin\\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${workspaceFolder}/build/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "调试器生成的任务。" } ] }
在vscode选择打开的文件夹下新建一个build文件夹,可以把exe文件都放到里面,更加美观。
如果使用code runner,在它的设置中找到settings.json文件进行修改,如下
{ "code-runner.executorMap": { "cpp": "cd $dir && g++ -std=c++11 $fileName -D LOCAL -o D:/code/C++/build/$fileNameWithoutExt.exe && D:/code/C++/build/$fileNameWithoutExt.exe" },//增添的的部分!!!路径改成自己建立的build文件夹,比如D:/code/C++/build(自己替换) "code-runner.runInTerminal": true, "code-runner.ignoreSelection": true, "c-cpp-compile-run.run-in-external-terminal": true, "workbench.iconTheme": "eq-material-theme-icons-palenight", "editor.fontSize": 18, "workbench.colorTheme": "Community Material Theme Palenight", "files.autoSave": "afterDelay", "extensions.ignoreRecommendations": true, "editor.hover.enabled": false, "editor.parameterHints.enabled": false, "terminal.integrated.scrollback": 1600, "bracket-pair-colorizer-2.depreciation-notice": false, "window.zoomLevel": 1 }
这篇关于关于vscode配置C/C++的配置文件问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-26MATLAB 中 A(7)=[];什么意思?-icode9专业技术文章分享
- 2024-11-26UniApp 中如何实现使用输入法时保持页面列表不动的效果?-icode9专业技术文章分享
- 2024-11-26在 UniApp 中怎么实现输入法弹出时禁止页面向上滚动?-icode9专业技术文章分享
- 2024-11-26WebSocket是什么,怎么使用?-icode9专业技术文章分享
- 2024-11-26页面有多个ref 要动态传入怎么实现?-icode9专业技术文章分享
- 2024-11-26在 UniApp 中实现一个底部输入框的常见方法有哪些?-icode9专业技术文章分享
- 2024-11-26RocketMQ入门指南:搭建与使用全流程详解
- 2024-11-26RocketMQ入门教程:轻松搭建与使用指南
- 2024-11-26手写RocketMQ:从入门到实践的简单教程
- 2024-11-25【机器学习(二)】分类和回归任务-决策树(Decision Tree,DT)算法-Sentosa_DSML社区版