title: gcc and g++ error: error trying to exec 'cc1plus': execvp: No such file or directory
body: <p>I'm having problems compiling <code>.c</code> and <code>.cpp</code> files using <code>gcc</code> and <code>g++</code>, for both cases i got the message:</p>
  
  
  
  <pre><code>g++(or gcc): error trying to exec 'cc1plus': execvp: No such file or directory`
  </code></pre>
  
  <p>I've already tried to reinstall both gcc and <code>g++</code> and be sure that they're both in the same version.</p>
  
  <p>Edits: I'm using ubuntu 16.04.1 LTS, both g++ and gcc are in version 5.4.0 20160609.</p>
  
  <p>The following is the output of <code>echo | g++ -v -xc++ -fsyntax-only -</code>:</p>
  
  <pre><code>Using built-in specs.
  COLLECT_GCC=g++
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
  COLLECT_GCC_OPTIONS='-v' '-fsyntax-only' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
   cc1plus -quiet -v -imultiarch x86_64-linux-gnu -iprefix ../lib/gcc/x86_64-linux-gnu/5/ -D_GNU_SOURCE - -quiet -dumpbase - -mtune=generic -march=x86-64 -auxbase - -version -fsyntax-only -o /dev/null -fstack-protector-strong -Wformat -Wformat-security
  g++: error trying to exec 'cc1plus': execvp: No such file or directory
  </code></pre>
  
  <p>Thats the outuput of compiling a hello world program with gcc -v:</p>
  
  <pre><code>Using built-in specs.
  COLLECT_GCC=gcc
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
  COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
   cc1 -quiet -v -imultiarch x86_64-linux-gnu -iprefix ../lib/gcc/x86_64-linux-gnu/5/ codigo.c -quiet -dumpbase codigo.c -mtune=generic -march=x86-64 -auxbase codigo -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cckVKe9E.s
  gcc: error trying to exec 'cc1': execvp: No such file or directory
  </code></pre>
  
  <p>The following is the output of <code>/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus &lt;/dev/null</code>:</p>
  
  <pre><code>Analyzing compilation unit
  Performing interprocedural optimizations
   &lt;*free_lang_data&gt; &lt;visibility&gt; &lt;build_ssa_passes&gt; &lt;opt_local_passes&gt; &lt;free-inline-summary&gt; &lt;whole-program&gt; &lt;inline&gt;Assembling functions:
  
  Execution times (seconds)
   phase setup             :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (20%) wall    1408 kB (81%) ggc
   phase parsing           :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (20%) wall     318 kB (18%) ggc
   parser (global)         :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (20%) wall     302 kB (17%) ggc
   TOTAL                 :   0.00             0.00             0.05               1746 kB
  </code></pre>