你的 C++ 编译器不完全支持 C++17

Your C++ compiler does NOT fully support C++17

Searching Python 3.6 libraries...                                  
Found Python library: /home/luan/anaconda3/envs/za/lib/libpython3.6m.so
Found Python headers folder: /home/luan/anaconda3/envs/za/include/python3.6m
-- The C compiler identification is GNU 7.5.0             
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc              
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info      
-- Detecting C compiler ABI info - done                               
-- Detecting C compile features            
-- Detecting C compile features - done                    
-- Check for working CXX compiler: /usr/bin/c++     
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info                 
-- Detecting CXX compiler ABI info - done                
-- Detecting CXX compile features          
-- Detecting CXX compile features - done       
CMake Error at CMakeLists.txt:232 (message):    
  **Your C++ compiler does NOT fully support C++17.**    
                                             
                                                
-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_6b5ro8ju/CMakeFiles/CMakeOutput.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.

我的解决方案:安装 G++-8(按照这个答案https://askubuntu.com/a/1028656/987517

sudo apt-get install g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8

如果你恰好是用Homebrew安装的gcc,步骤略有不同:

> brew install gcc@8
> brew unlink gcc
> brew link gcc@8

(Homebrew还有其他版本的gcc,大家可以运行 brew search gcc一一查看。)

请注意,即使 PATH 中的 gcc 指向您的系统 gcc(例如 /usr/bin/gcc),setup/install/make 脚本 运行在不同的环境中运行可能仍然会看到你的 Homebrew 版本的 gcc。这就是发生在我身上的事情,@Luan Pham 的回答中的步骤因此没有奏效!

作为在 中将 gcc-8 设置为默认编译器的替代方法,您还可以将环境变量传递给 YouCompleteMe 的安装命令,如下所示:

CC=gcc-8 CXX=g++-8 python3 ./install.py

那么您不需要更新默认值 gcc,如果不需要的话。

如果你使用的是centos,你应该安装devtoolset-8

Developer Toolset 8

sudo yum install centos-release-scl
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum install devtoolset-8
scl enable devtoolset-8 bash