step
1. Open the folder where the project is located, select a cpp file, press F5, and select c++(windows)
2. Open launch.json, select c++(windows)
3. Modify launch.json as follows, and change "program" to the program path that needs to be debugged.
- launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "启动",
"type": "cppvsdbg",
"request": "launch",
"args": ["args1","args2"],
"program": "D:/Project/xxxxx/GameServer.exe"
}
]
}
4. Add a breakpoint at the code and press F5 to enter debugging.
ps: It is possible to use vscode to compile the mfc project, but it is probably more troublesome. I am satisfied with being able to debug programs compiled by Microsoft Visual Studio.