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

后端 未结 9 1661
情深已故
情深已故 2020-12-04 20:52

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          


        
相关标签:
9条回答
  • 2020-12-04 21:18

    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

    0 讨论(0)
  • 2020-12-04 21:24

    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.

    0 讨论(0)
  • 2020-12-04 21:28

    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
    
    0 讨论(0)
提交回复
热议问题