Setting up the Clang_complete plugin everytime I create a fresh Linux installation is a pain in the back, even do I’ve written an instructables for my self. So this is the newest instructables right away I’ve made it work and before I forget the steps I followed.
1 Install the Clang compiler and friends.
sudo apt-get install clang libclang-dev
2 Make a soft link from libclang.so to libclang-x.y-so.1, where x.y is the library’s release.
In my case, as in august 2016, it’s 3.8, so:
cd /usr/lib/x86_64-linux-gnu/ sudo ln -s libclang-3.8-so.1 libclang.so
3 Install the clang_complete plugin.
I’m using pathogen to manage my plugins, so inside the bundle directory download the plugin:
git clone https://github.com/Rip-Rip/clang_complete.git
Then enter into the newest directory and type (doesn’t need to be the root user):
4 Finally, show to VIM where the Clang library is.
In your .vimrc file add these lines:
let g:clang_library_path = '/usr/lib/x86_64-linux-gnu' let g:clang_c_options = '-std=gnu11' let g:clang_cpp_options = '-std=c++11 -stdlib=libc++' let g:clang_complete = 1 "automatically selects the first entry in the popup menu let g:clang_snippets = 1 "do some snippets magic on code placehorlders like funcion argument, template parameters, etc. let g:clang_close_preview = 1
Among all those lines the most important one is:
let g:clang_library_path = '/usr/lib/x86_64-linux-gnu'
5 Cross your fingers and test it!