Ubuntu14.04 安装VIM8 PluginInstall安装YouCompleteMe插件,编译错误解决

环境:ubuntu14.04
问题:编译YouCompleteMe时出现如下错误:

ubuntu:~/.vim/bundle/YouCompleteMe$ ./install.py --clang-completer
Searching Python 2.7 libraries...
Found Python library: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: /tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/bin/make" "cmTC_65fdf/fast"
  /usr/bin/make -f CMakeFiles/cmTC_65fdf.dir/build.make
  CMakeFiles/cmTC_65fdf.dir/build
  make[1]: Entering directory `/tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeTmp'
  Building C object CMakeFiles/cmTC_65fdf.dir/testCCompiler.c.o
  /usr/bin/cc -o CMakeFiles/cmTC_65fdf.dir/testCCompiler.c.o -c
  /tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeTmp/testCCompiler.c
  /tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeTmp/testCCompiler.c:2:3: error:
  #error "The CMAKE_C_COMPILER is set to a C++ compiler"
   # error "The CMAKE_C_COMPILER is set to a C++ compiler"
     ^
  make[1]: *** [CMakeFiles/cmTC_65fdf.dir/testCCompiler.c.o] Error 1
  make[1]: Leaving directory `/tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeTmp'
  make: *** [cmTC_65fdf/fast] Error 2


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:26 (project)

-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeOutput.log".
See also "/tmp/ycm_build_aZuJ5b/CMakeFiles/CMakeError.log".
ERROR: the build failed.
NOTE: it is *highly* unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.

解决方法:

将gcc g++编译器版本由 4.4.7 升级为5.0.4
关键步骤(以下步骤是必须的):
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update


sudo apt-get install gcc-5          # gcc可以不升级依然用4.6,只装g++5
sudo apt-get install g++-5
sudo apt-get install gcc-5-multilib # gcc可以不升级依然用4.6,只装g++5
sudo apt-get install g++-5-multilib
sudo apt-get install g++-5-doc      # 可选


可选(之后g++命令默认指向g++5.x.x)

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --config g++ 
根据提示选择默认的版本


现在就可以使用了,通过g++  -v 命令可以查看当前gcc或者g++的版本


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

科技之光666

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值