vscode-cpptools
vscode-cpptools copied to clipboard
Cannot find c++ std headers even manually set include path.
Environment
- OS and Version: macos 14.4.1 (23E224)
- VS Code Version: Version: 1.88.1
- C/C++ Extension Version: v1.19.9
- If using SSH remote, specify OS of remote machine: ubuntu 22.04
Bug Summary and Steps to Reproduce
Bug Summary:
- VSCode cannot find std headers (such as
<algorithm>
,<string>
), even if I manually specifyincludePath
andsystemIncludePath
. - The project is built successfully in terminal alone. It is also built smoothly with cmake-tools extension (click "configure" and "build" icon in cmake panel). The only problem is the intelligence tooltips.)
- I've installed c/c++, c/c++ extension pack, and clangd extensions.
Steps to reproduce:
- SSH remote to my developing computer, which is an arm linux machine with OS ubuntu 22.04.
- Enter the project folder, and build with building script
./script/build.sh
and it works well. - Remove the
build
folder and enter the "CMake" panel. Click "Delete cache and reconfigure" icon (or cmd+shift+p and choose "CMake: Delete cache and reconfigure") -- it configure successfully. Then click "Build" icon (or cmd+shift+p and choose "CMake: Build target") -- it build successfully. - Open any source file, the error "file not found" is shown on the first
#include <...>
line. The error is only on the std headers, while the project headers are all OK. - I checked the
compile_commands.json
. It is generated successfully and I've copied it tobuild/compile_commands.json
where it should be. - I manually set "C_Cpp.default.includePath" and "C_Cpp.default.systemIncludePath" but it won't help.
Expected behavior: C++ std header files can be find correctly.
Configuration and Logs
The configuration is:
{
"cmake.configureEnvironment": {
"PKG_CONFIG_PATH": "${workspaceFolder}/lib/opencv/lib/pkgconfig:${workspaceFolder}/lib/rknpu2/lib/pkgconfig"
},
"cmake.buildDirectory": "${workspaceFolder}/build/build_linux_aarch64",
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json",
"C_Cpp.default.cppStandard": "c++14",
"C_Cpp.default.includePath": [
"${workspaceFolder}",
"/usr/include/c++/11"
],
"C_Cpp.default.systemIncludePath": [
"/usr/include/c++/11"
]
}
There is no `C/C++: Log Diagnostics` in my command palette.
The output of `clangd` is:
```log
I[11:29:26.388] Ubuntu clangd version 12.0.1-19ubuntu3
I[11:29:26.388] PID: 1287776
I[11:29:26.388] Working directory: /home/orangepi/zhangjiajie/surveillance_ai
I[11:29:26.388] argv[0]: /usr/bin/clangd-12
I[11:29:26.388] Starting LSP over stdin/stdout
I[11:29:26.389] <-- initialize(0)
I[11:29:26.390] --> reply:initialize(0) 0 ms
I[11:29:26.613] <-- initialized
I[11:29:26.668] <-- textDocument/didOpen
I[11:29:26.672] Loaded compilation database from /home/orangepi/zhangjiajie/surveillance_ai/build/compile_commands.json
I[11:29:26.674] --> window/workDoneProgress/create(0)
I[11:29:26.674] Enqueueing 43 commands for indexing
I[11:29:26.676] ASTWorker building file /home/orangepi/zhangjiajie/surveillance_ai/src/roi/roi_pipeline.h version 1 with command inferred from /home/orangepi/zhangjiajie/surveillance_ai/src/roi/roi_pipeline.cc
[/home/orangepi/zhangjiajie/surveillance_ai/build/build_linux_aarch64]
/usr/bin/c++ --driver-mode=g++ -DWZAI_USE_OPENCV_ALL -Dwzai_EXPORTS -I/home/orangepi/zhangjiajie/surveillance_ai -I/home/orangepi/zhangjiajie/surveillance_ai/third_party/miniz -I/home/orangepi/zhangjiajie/surveillance_ai/third_party/crypt -I/home/orangepi/zhangjiajie/surveillance_ai/lib/rknpu2/lib/pkgconfig/../../include -I/home/orangepi/zhangjiajie/surveillance_ai/lib/opencv/lib/pkgconfig/../../include/opencv -I/home/orangepi/zhangjiajie/surveillance_ai/lib/opencv/lib/pkgconfig/../../include -g -fPIC -c -x c++-header -std=c++14 /home/orangepi/zhangjiajie/surveillance_ai/src/roi/roi_pipeline.h -fsyntax-only -resource-dir=/usr/lib/llvm-12/lib/clang/12.0.1
I[11:29:26.680] --> textDocument/clangd.fileStatus
I[11:29:26.812] Loaded compilation database from /home/orangepi/zhangjiajie/surveillance_ai/build/build_linux_aarch64/compile_commands.json
I[11:29:26.822] <-- textDocument/documentSymbol(1)
I[11:29:26.822] <-- textDocument/documentLink(2)
I[11:29:26.823] <-- textDocument/codeAction(3)
I[11:29:26.922] <-- reply(0)
I[11:29:26.922] --> $/progress
I[11:29:26.922] --> $/progress
I[11:29:27.028] <-- textDocument/documentSymbol(4)
I[11:29:27.083] --> $/progress
I[11:29:27.083] --> $/progress
I[11:29:27.167] <-- textDocument/semanticTokens/full(5)
I[11:29:27.716] --> textDocument/publishDiagnostics
I[11:29:27.720] --> reply:textDocument/documentSymbol(1) 897 ms
I[11:29:27.721] --> reply:textDocument/documentLink(2) 898 ms
I[11:29:27.722] --> reply:textDocument/codeAction(3) 898 ms
I[11:29:27.723] --> reply:textDocument/documentSymbol(4) 694 ms
I[11:29:27.724] --> reply:textDocument/semanticTokens/full(5) 556 ms
I[11:29:27.724] --> textDocument/clangd.fileStatus
### Other Extensions
I have installed C/C++, C/C++ extension pack, CMake, CMake Tools, clangd, C/C++ themes.
### Additional context
_No response_