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

6

39

I am using ubuntu 12.04. I'm trying to "make" a project.

I get this error:

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

I have g++ installed.

Earlineearls answered 14/3, 2014 at 19:30 Comment(1)
I just had the same issue with installing a Python package (pandas) with C++ extension, and this answer has helped me. I had gcc 4.9 and g++ 4.8. Once I downgraded gcc to 4.8 with aptitude to make the versions match the issue was resolved.Sheilahshekel
A
32

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++.

Axiology answered 14/1, 2015 at 13:52 Comment(0)
P
22

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

Periphrastic answered 4/8, 2014 at 9:8 Comment(0)
M
15

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"
Military answered 1/10, 2017 at 10:25 Comment(2)
Same for me on centOS. Corrected path on .bash_profileDelubrum
This works! I use aws ec2, "cc1plus" was installed but not in $PATH so sasl install was failed!Capitate
M
5

you say you already have g++ installed however it was not installed correctly ... revert what you did to install g++ then run this to install the bundle of developer tools

sudo apt-get update
sudo apt-get upgrade 
sudo apt-get install libtool autoconf build-essential pkg-config automake tcsh

which includes g++ and the entire make toolchain of utils

Mantelet answered 3/11, 2017 at 10:39 Comment(0)
J
2

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.

Juna answered 16/3, 2014 at 18:20 Comment(1)
I have this problem too—and which g++ gives me /usr/bin/g++.Nestornestorian
E
0

Make sure gcc and g++ have the same version.

gcc --version
g++ --version

sudo apt-get install gcc-x.x
sudo apt-get install g++-x.x

The issue will be resolved.

Eyebrow answered 25/7 at 3:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.