0

So I have been using NeoVim for some time and installed the clang_complete plugin. It works well with neovim when I am working in C files. It even works for my c++ project files when I add the include directory to the .clang_compete file as

-Isrc/include

enter image description here

enter image description here

But it does not work for standard c++ header files.

I installed llvm in my macos with brew

brew install llvm

It is installed at /usr/local/Cellar/llvm/10.0.0_1/ and linked at /usr/local/opt/llvm/

enter image description here

enter image description here

My ~/.zshrc file:

export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
ctags=/usr/local/bin/ctags
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export CPATH="/usr/local/opt/llvm/include"

alias gcc="clang"
alias g++="clang++"

My init.vim file:

let g:clang_library_path='/usr/local/opt/llvm/lib'
let g:clang_user_options='|| exit 0'
let g:clang_user_options = '-std=c++14 -Wall -DDEGUB -I/usr/local/llvm/include'

I also tried to change my .clang_complete to :

I/usr/local/opt/llvm/include/c++/v1/
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/

But it does not work for C++ standard libraries.

Amit Adhikari
  • 660
  • 1
  • 5
  • 10
  • 1
    If you use the paths returned by `clang++ -E -xc++ - -Wp,-v < /dev/null` does it work? (Or may are they the same paths?) – Luc Hermitte Apr 05 '20 at 22:06
  • @LucHermitte it returns ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/v1" ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/local/include" ignoring nonexistent directory #include "..." search starts here: #include <...> search starts here: /usr/local/opt/llvm/include /usr/local/opt/llvm/bin/../include/c++/v1 /usr/local/Cellar/llvm/10.0.0_1/lib/clang/10.0.0/include /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include – Amit Adhikari Apr 05 '20 at 22:09
  • @LucHermitte i included those paths in .clang_complete but still doesn't work :( – Amit Adhikari Apr 05 '20 at 22:12
  • I got the vector completion working after adding both of these to .clang_complete -I/usr/local/opt/llvm/include/c++/v1 -I/usr/local/opt/llvm/lib/clang/10.0.0/include But the include still doesn't seem to work. – Amit Adhikari Apr 05 '20 at 23:16

0 Answers0