解决方法
把 .vscode
下 compileCommands_***.json
里的C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe
替换成
\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe\"
(开始和结束加\"
)
比如:
{
"file": "D:\\\\Unreal_Projects\\\\new_try\\\\Source\\\\new_try\\\\new_try.h",
"command": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe @\"D:\\Unreal_Projects\\new_try\\.vscode\\compileCommands_new_try\\new_try.210.rsp\"",
"directory": "D:\\epics\\UE_4.27\\Engine\\Source"
},
替换成
{
"file": "D:\\\\Unreal_Projects\\\\new_try\\\\Source\\\\new_try\\\\new_try.h",
"command": "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe\" @\"D:\\Unreal_Projects\\new_try\\.vscode\\compileCommands_new_try\\new_try.210.rsp\"",
"directory": "D:\\epics\\UE_4.27\\Engine\\Source"
},
原回答还有其他解决方法,比如用vscode插件或者python脚本