Open imikejackson opened 3 years ago
try add some code in ~/Library/Preferences/clangd/config.yaml
if you install llvm and xcode
CompileFlags:
Add: [
-isystem/usr/local/opt/llvm/include/c++/v1,
-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
]
if you only install llvm
CompileFlags:
Add: [
-isystem/usr/local/opt/llvm/include/c++/v1,
-L/usr/local/opt/llvm/lib/clang/11.1.0
]
it work for me
me too
I found add qurey driver help to make it work
"clangd.arguments": [
+ "--query-driver=/usr/bin/clang++",
],
I found add qurey driver help to make it work
"clangd.arguments": [ + "--query-driver=/usr/bin/clang++", ],
I think this should be the default setting on macos, it was a pain to find this.
Some discussion about that in https://github.com/clangd/clangd/issues/539
Hey, if someone ends on this issue like me I found this snippet from the installation page very useful! It helps generating a compile_commands.json
that clangd
will use to find your project's deps 😉
If your project builds with CMake, it can generate this file. You should enable it with:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
compile_commands.json will be written to your build directory. If your build directory is $SRC or $SRC/build, clangd will find it. Otherwise, symlink or copy it to $SRC, the root of your source tree.
ln -s ~/myproject-build/compile_commands.json ~/myproject/
Please describe the problem. For hints on what information is helpful, see: https://clangd.llvm.org/troubleshooting.html
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
C++ file where #Include or really any standard C++ file is included. None of the includes will resolve.
Logs Please attach the clangd log from the "Output" window if you can. If possible, run with
--log=verbose
- note that the logs will include the contents of open files! clangd.logSystem information Clangd version : 11.0.0 clangd extension version: 0.1.11 Operating system:macOS 10.15