系统环境:
OS:Ubuntu 22.04.1
1. 问题发生
笔者发生该问题是在安装 YouCompleteMe
插件时发生的,不过看网上也有很多朋友也会因为其它原因出现该问题。
imaginemiracle:YouCompleteMe$ python3 ./install.py
Searching Python 3.10 libraries...
#######library_dirs############
['/usr/lib/python3.10/config-3.10-x86_64-linux-gnu', '/usr/lib64', '/usr/lib']
#######library_dirs############
......
......
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:26 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/tmp/ycm_build_1xto_wp_/CMakeFiles/CMakeOutput.log".
See also "/tmp/ycm_build_1xto_wp_/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.
2. 解决方法
执行如下命令,即安装 build-essential
imaginemiracle:~$ sudo apt-get update && sudo apt-get install build-essential
到这里,我自己的问题已经解决了,按照之前安装不会再出现问题,不过有可能只安装完这个还会出现上述报错,应该是没有安装 g++
的缘故,尝试再安装一次 g++
看是否对你有帮助。