Sch*_*tze 5 gcc g++ ubuntu-18.04
我正在尝试从 Google 安装 gtest,但即使我安装了 gcc 和 g++,由于某种原因我还是收到了这个错误。我在 Ubuntu 18.04 64 位上。而且我与 Visual Studio 的东西没有任何关系。
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:47 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_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 "/usr/src/googletest/googletest/CMakeFiles/CMakeOutput.log".
See also "/usr/src/googletest/googletest/CMakeFiles/CMakeError.log".
Run Code Online (Sandbox Code Playgroud)
这是那里:
$ gcc --version
gcc (GCC) 6.4.0
$ g++ --version
g++ (GCC) 6.4.0
Run Code Online (Sandbox Code Playgroud)
和这个:
user@user:/usr/src/gtest$ whereis g++
g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz
user@user:/usr/src/gtest$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/local/cuda-9.0/bin/gcc /usr/share/man/man1/gcc.1.gz
Run Code Online (Sandbox Code Playgroud)
还:
user@user:/usr/src/gtest$ ls -la /usr/bin | grep gcc-6.4
lrwxrwxrwx 1 root root 16 Nov 12 14:47 gcc -> /usr/bin/gcc-6.4
user@user:/usr/src/gtest$ ls -la /usr/bin | grep g++-6
lrwxrwxrwx 1 root root 14 Nov 12 14:51 g++ -> /usr/bin/g++-6
lrwxrwxrwx 1 root root 22 Apr 24 2018 g++-6 -> x86_64-linux-gnu-g++-6
-rwxr-xr-x 1 root root 953176 Apr 24 2018 x86_64-linux-gnu-g++-6
Run Code Online (Sandbox Code Playgroud)
鉴于这一切,有没有人有线索?
提前致谢。
更新:这似乎有效:
好的,这似乎有效:
cmake -D CMAKE_C_COMPILER="/usr/local/cuda-9.0/bin/gcc " -D CMAKE_CXX_COMPILER="/usr/bin/g++" /usr/src/gtest/CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
这显然指向 gcc 使用的 cuda。有没有办法将 /usr/bin/ 下的设置为默认设置?
| 归档时间: |
|
| 查看次数: |
14539 次 |
| 最近记录: |