I didn't know where to ask this question.
I'm using macOS High Sierra. I've installed clangd with the following commands:
However it doesn't seem to work correctly. I've tested with the following C++ code:
#include <iostream>
int main() {
std::cout << "hello\n";
}
It compiles fine but clangd shows the following error at the << operator:
invalid operands to binary expression ('std::__1::ostream' (aka 'int') and 'const char *')
Unfortunately I'm not an expert on clangd - @TalAmuyal might have some ideas here. It does seem like there is some configuration issue - there is a compile_commands.json file that you can use to specify some options: https://reviews.llvm.org/D37150 - might be worth checking that out. Given that Oni is showing the error, it seems like the Oni piece of the integration is working.
Might be worth checking out this mailing list too (or posting the question there): http://lists.llvm.org/mailman/listinfo/cfe-dev
Let us know if you find anything, it would be great to add it to the wiki: https://github.com/bryphe/oni/wiki/Language-Support
Sorry for the late reply.
I tried your snippet, it seems to work well for me.
I'm using a version of clangd I compiled from source though, so a newer version of clangd might help.
Notes:
'std::__1::ostream' (aka 'int') looks really suspicious).Thanks, I've had to install Command Line Tools, Xcode wasn't enough.
Below is a basic howto of the process. I've only copied the header files to minimize conflicts because the latest macOS uses llvm 4 and having multiple versions installed is not advised. Hopefully clangd will be included in the next version of macOS.
xcode-select --installbin/clangd to /usr/local/bin/lib/clang/芦clang version禄/include to /usr/local/lib/clang/芦clang version禄/include/c++/v1 to /usr/include/c++/Thanks @kuglee for sharing the steps you used to resolve it!
Most helpful comment
Thanks, I've had to install Command Line Tools, Xcode wasn't enough.
Below is a basic howto of the process. I've only copied the header files to minimize conflicts because the latest macOS uses llvm 4 and having multiple versions installed is not advised. Hopefully clangd will be included in the next version of macOS.
How to install clangd on macOS
xcode-select --installbin/clangdto/usr/local/bin/lib/clang/芦clang version禄/includeto/usr/local/lib/clang/芦clang version禄/include/c++/v1to/usr/include/c++/