本文主要是介绍VSCode C++ task.josn 与launch.json 文件的配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
task.json
{"version": "2.0.0","tasks": [{"type": "cppbuild","label": "C/C++: g++.exe 生成活动文件","command": "F:\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",// g++.exe c++编译的路径,根据实际情况进行修改"args": ["-fdiagnostics-color=always","-g","-fexec-charset=GBK", //编译器的输出编码 防止Windows控制台乱码"-finput-charset=UTF-8", //编译器的输入编码 也就是源代码的编码"${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"options": {"cwd": "${fileDirname}"},"problemMatcher": ["$gcc"],"group": {"kind": "build","isDefault": true},"detail": "编译器: F:\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe"}]
}
launch.json
{// 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "g++.exe - 生成和调试活动文件","type": "cppdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,"cwd": "${fileDirname}","environment": [],"externalConsole": true,//启用外部控制台进行调试,而不是VScode 自身集成的控制台"MIMode": "gdb","miDebuggerPath": "F:\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",// gdb.exe c++调试器的路径,根据实际情况进行修改"setupCommands": [{"description": "为 gdb 启用整齐打印","text": "-enable-pretty-printing","ignoreFailures": true}],"preLaunchTask": "C/C++: g++.exe 生成活动文件"}]
}
这篇关于VSCode C++ task.josn 与launch.json 文件的配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!