emacs-lsp / emacs-ccls

Emacs client for ccls, a C/C++ language server
200 stars 29 forks source link

[macOS Mojave] Best way to find C++ headers (memory, vector) and /usr/local/lib headers ? #87

Open the-drunk-coder opened 4 years ago

the-drunk-coder commented 4 years ago

Hi,

I'm running Emacs with CCLS on Linux and MacOS Mojave. On Linux the experience is fairly smooth, but on macOS I'm running into some problems. I'm using an executable wrapper as recommended in the Wiki, but I had to make some modifications to get it somewhat up and running ... here it is:

#!/bin/sh
exec /usr/local/bin/ccls -init='{"clang":{"extraArgs":[
"-stdlib=libc++",
"-std=c++17",
"-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
#"-isysroot", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
"-I", "/usr/local/include",
"-I", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
]}}' "$@"

Without the explicit reference to the C++ headers and /usr/local/include, the headers aren't found at all. With the references, the headers are found but unique_ptr and make_unique etc. aren't completed and show up as red. The -isysroot line doesn't really make a difference.

Plus, all files basically end with an error message saying: ccls: no member named 'value' in 'std::__1::__is_default_allocator***

In total, the experience isn't all that satisfying on macOS ... is there a way to improve it ?

Best, N