g++: error trying to exec 'cc1plus': execvp: No such file or directory

不羁的心 提交于 2019-11-29 05:25:44

I tried the command @MonoThreaded gave but it failed. I tried below and it works.

sudo apt-get install g++

Please don't include any version after the g++.

I faced the same issue after upgrading gcc to 4.8
sudo apt-get install gcc-4.8 (mind the package name)
Then I manually changed the g++ link to a renamed copy of gcc-4.8

My fix was a proper g++ installation
sudo apt-get install g++-4.8

For clarity you should use g++-4.8 instead of gcc-4.8

I have g++ and gcc installed.

sudo find / -name "cc1plus"

Gave me something like /usr/lib/gcc/x86_64-linux-gnu/<version>/cc1plus

So I added it to the $PATH

export PATH="/usr/lib/gcc/x86_64-linux-gnu/<version>:$PATH"

I have g++ installed.

You do, but you don't have it installed correctly.

First run which g++ -- it's likely that your PATH is pointing at something other than /usr/bin/g++, and that version is not properly installed.

you need to install the bundle of developer tools

sudo apt-get install build-essential

which includes g++ and the entire make toolchain utils

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!