說明
我電腦的系統參數(用 uname -a命令查看)如下:
Linux avyn-Lenovo 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:08:14 UTC 2015 i686 i686 i686 GNU/Linux
i686表明了我用的是32位的操作系統,如果是X86_64則表明你用的是64位的系統。而安裝YouComplete插件,官方文檔中(路徑為YouCompleteMe/doc/youcompleteme.txt)有關於X86_64系統的安裝方法說明,我的32位操作系統安裝要稍微復雜一些。
關於YouCompleteMe插件
YouCompleteMe插件簡稱YCM插件,主要是用於在用vim編輯器編寫代碼時,能夠實現代碼自動補全的功能,這樣能夠大大提高我們的工作效率。支持C/C++/C#/Python等語言,非常地方便。
安裝vim插件之前最好先安裝vim插件管理器vundle,參考鏈接:http://www.cnblogs.com/respawn/archive/2012/08/21/2649483.html
安裝步驟可以查看YouCompleteMe/doc/youcompleteme.txt 298~341行,截圖如下:
也可以參考github上的說明:https://github.com/Valloric/YouCompleteMe#ubuntu-linux-x64-super-quick-installation
這里需要特別說明的是,在要支持C-family自動補全時,官方文檔上說的 ./install.sh --clang-completer並不適用於32位的系統,會報如下錯誤:
STDERR: Your C++ compiler supports C++11, compiling in that mode. Downloading Clang 3.5 CMake Error at ycm/CMakeLists.txt:62 (message): No pre-built Clang 3.6 binaries for 32 bit linux. You'll have to compile Clang 3.6 from source. See the YCM docs for details on how to use a user-compiled libclang.
這里的意思就是說沒有支持32位Linux的Clang(一款可以編譯C語言,C++等的輕量級編譯器),需要自己通過源代碼進行編譯。
怎么編譯Clang
參考鏈接1:https://solarianprogrammer.com/2013/01/17/building-clang-libcpp-ubuntu-linux/
參考鏈接2:http://www.linuxzen.com/vim-dai-ma-bu-quan-he-jian-cha-youcompleteme-syntastic.html