When I compile C/C++ program with popen
in php
... I got this error:
g++: error trying to exec \'cc1plus\': execvp: No such file or
You may have this issue as well if you have environment variable GCC_ROOT pointing to a wrong location. Probably simplest fix could be (on *nix like system):
unset GCC_ROOT
in more complicated cases you may need to repoint it to proper location
I had the same issue with gcc "gnat1" and it was due to the path being wrong. Gnat1 was on version 4.6 but I was executing version 4.8.1, which I had installed. As a temporary solution, I copied gnat1 from 4.6 and pasted under the 4.8.1 folder.
The path to gcc on my computer is /usr/lib/gcc/i686-linux-gnu/
You can find the path by using the find command:
find /usr -name "gnat1"
In your case you would look for cc1plus:
find /usr -name "cc1plus"
Of course, this is a quick solution and a more solid answer would be fixing the broken path.
Something went wrong with your GCC installation. Try reinstalling the it like this:
sudo apt-get install --reinstall g++-5
In Ubuntu the g++
is a dependency package that installs the default version of g++
for your OS version. So simply removing and installing the package again won't work, cause it will install the default version. That's why you need to reinstall.
Note: You can replace the g++-5
with your desired g++
version. To find your current g++
version run this:
g++ --version