1、打开vscode: 文件 -> 将工作区另存为,,将文件夹添加到工作区。
2、按快捷键ctrl+p,之后点击edit configurations,打开c_cpp_properties.json文件,检查 includepath 字段。。
如:
{ "configurations": [ { "name": "win32", "includepath": [ "${workspacefolder}/**", "c:/keil_v5/arm/armcc/include" ], "defines": [ "_debug", "unicode", "_unicode" ], "compilerpath": "c:\\\\program files\\\\llvm\\\\bin\\\\clang.exe", "cstandard": "c11", "cppstandard": "c++17", "intellisensemode": "clang-x64" } ], "version": 4}
如果添加了其它路径 "c:/keil_v5/arm/armcc/include" 就会造成无法跳转,最后只能改成:
{ "configurations": [ { "name": "win32", "includepath": [ "${workspacefolder}/**" ], "defines": [ "_debug", "unicode", "_unicode" ], "compilerpath": "c:\\\\program files\\\\llvm\\\\bin\\\\clang.exe", "cstandard": "c11", "cppstandard": "c++17", "intellisensemode": "clang-x64" } ], "version": 4}
ctrl+左键,f12都可以跳转。
相关文章教程推荐:vscode教程
以上就是vscode无法跳转到定义的详细内容。
