不知道題主的vscode用的爽不,我正好搜到你的,然後我解決了。一鍵直接編譯除錯,斷點vscode配置C/C++的編譯除錯環境安裝debug外掛,然後配置如下,詳情參考上面連結//launch.json{"version": "0.
2.0","configurations": [{"name": "Debug","type": "gdb","request": "launch","target": "${file}.o","cwd": "${workspaceRoot}","preLaunchTask": "gcc"}]}//tasks.json{"version": "0.
1.0","command": "gcc","args": ["-g", "${file}", "-o", "${file}.o"],"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "${workspaceRoot}"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}}}
不知道題主的vscode用的爽不,我正好搜到你的,然後我解決了。一鍵直接編譯除錯,斷點vscode配置C/C++的編譯除錯環境安裝debug外掛,然後配置如下,詳情參考上面連結//launch.json{"version": "0.
2.0","configurations": [{"name": "Debug","type": "gdb","request": "launch","target": "${file}.o","cwd": "${workspaceRoot}","preLaunchTask": "gcc"}]}//tasks.json{"version": "0.
1.0","command": "gcc","args": ["-g", "${file}", "-o", "${file}.o"],"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "${workspaceRoot}"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}}}