title: Ubuntu 18.04: No CMAKE_C_COMPILER could be found
body: <p>I am trying to install gtest from Google but even though I have gcc and g++ installed, I get this error for some reason. I am on Ubuntu 18.04 64 bit. And I don't have anything to do with Visual Studio stuff.</p>
  
  <pre><code>-- 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".
  </code></pre>
  
  <p>This is there:</p>
  
  <pre><code>$ gcc --version
  gcc (GCC) 6.4.0
  
  $ g++ --version 
  g++ (GCC) 6.4.0
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>also:</p>
  
  <pre><code>user@user:/usr/src/gtest$ ls -la /usr/bin | grep gcc-6.4
  lrwxrwxrwx  1 root root          16 Nov 12 14:47 gcc -&gt; /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++ -&gt; /usr/bin/g++-6
  lrwxrwxrwx  1 root root          22 Apr 24  2018 g++-6 -&gt; x86_64-linux-gnu-g++-6
  -rwxr-xr-x  1 root root      953176 Apr 24  2018 x86_64-linux-gnu-g++-6
  </code></pre>
  
  <p>Given all this, does anyone have a clue? </p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE:</strong> This seems to have worked: </p>
  
  <p>Okay, this seems to be working:</p>
  
  <pre><code>cmake -D CMAKE_C_COMPILER="/usr/local/cuda-9.0/bin/gcc " -D CMAKE_CXX_COMPILER="/usr/bin/g++" /usr/src/gtest/CMakeLists.txt
  </code></pre>
  
  <p>which apparently points to the gcc used cuda. Is there a way of setting the one under /usr/bin/ as the default one?</p>