设置搜索这几个,并设置为对应值。
如果没解决,可能是clangd的问题。
禁用clangd,然后去看看c_cpp_properties.json。
看complierPath是不是clang。 如果是,改成g++/gcc。
再看一下intelliSenseMode是不是clang。如果是,改为default。
linux下c_cpp_properties.json的配置
- {
- "configurations": [
- {
- "name": "Linux",
- "includePath": [
- "/usr/include",
- "/usr/local/include",
- "${workspaceFolder}/**"
- ],
- "defines": [],
- "compilerPath": "/usr/bin/g++",
- "cStandard": "c23",
- "cppStandard": "c++20",
- "browse":{"path":[
- "/usr/include",
- "/usr/local/include",
- "${workspaceFolder}/**"
- ]
- },
- "intelliSenseMode": "${default}"
- }
- ],
- "version": 4
- }
windows下c_cpp_properties.json的配置
- {
- "configurations": [
- {
- "name": "Win32",
- "includePath": [
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++",
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/x86_64-w64-mingw32",
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward",
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include",
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include-fixed",
- "D:/programme/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/include"
- ],
- "defines": [
- "_DEBUG",
- "UNICODE",
- "_UNICODE"
- ],
- "compilerPath": "D:\\programme\\mingw64\\bin\\g++.exe",
- "cStandard": "c23",
- "cppStandard": "c++23",
- "intelliSenseMode": "windows-gcc-x64"
- },
- "version": 4
- }
如果嫌vscode自带的补全太慢,可以更改以下设置(默认为10,建议改到5以下)
参考文章:
VSCode C/C++无法跳转到定义、自动补全、悬停提示功能
标签:bin,补全,..,vscode,C++,mingw32,64,w64,include From: https://www.cnblogs.com/lidabo/p/18347053