配置参考:
windows环境下VSCode配置C++教程(使用msvc编译器)-CSDN博客
VSCode配置msvc编译调试环境_vscode msvc-CSDN博客
异常参考:
vscode调试c++断点失效解决方法_vscode断点变空心-CSDN博客
`task.json` 相当于使用powershell 执行cl.exe,然后添加上一些参数;
可以使用shift+ctrl+b来运行
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "C/C++ Executable: build current active file","type": "shell","command": "cl.exe","args": ["/EHsc", "${file}","/Fo:", "${fileDirname}\\","/Fe:", "${fileDirname}\\${fileBasenameNoExtension}.exe","/DEBUG",],"problemMatcher": "$msCompile","detail": "Build only the current active file."},]
}
c_cpp_properties.json
{"configurations": [{"name": "Win32","includePath": ["${workspaceFolder}/**"],"defines": ["_DEBUG","UNICODE","_UNICODE"],"intelliSenseMode": "windows-msvc-x64","compilerPath": "D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe","cStandard": "c17","cppStandard": "c++20","windowsSdkVersion": "10.0.22621.0"}],"version": 4
}
launch.json可以通过运行-添加配置-选择cl来生成;