【親測】<g++/gcc>CentOS下g++: command not found問題的解決(c++環境安裝)
阿新 • • 發佈:2018-08-27
fin define time version csdn cannot result clas 代碼
CentOS下g++: command not found問題的解決
2017年02月27日 18:09:06 閱讀數:5174 個人分類: 問題分析 版權聲明:本文章是作者辛勤書寫的成果,如需轉載,請與作者聯系,並保留作者信息以及原文鏈接,謝謝~~ https://blog.csdn.net/blueheart20/article/details/581731901. 問題的提出
在安裝extundelete的過程中,發現在configure過程中,出錯了,具體的錯誤信息如下:
- configure:2865: g++ --version >&5
- ./configure: line 2867: g++: command not found
- configure:2876: $? = 127
- configure:2865: g++ -v >&5
- ./configure: line 2867: g++: command not found
- configure:2876: $? = 127
- configure:2865: g++ -V >&5
- ./configure: line 2867: g++: command not found
- configure:2876: $? = 127
- configure:2865: g++ -qversion >&5
- ./configure: line 2867: g++: command not found
- configure:2876: $? = 127
- configure:2896: checking whether the C++ compiler works
- configure:2918: g++ conftest.cpp >&5
- ./configure: line 2920: g++: command not found
- configure:2922: $? = 127
- configure:2960: result: no
- configure: failed program was:
- | /* confdefs.h */
- | #define PACKAGE_NAME "extundelete"
- | #define PACKAGE_TARNAME "extundelete"
- | #define PACKAGE_VERSION "0.2.4"
- | #define PACKAGE_STRING "extundelete 0.2.4"
- | #define PACKAGE_BUGREPORT "extundelete.sourceforge.net"
- | #define PACKAGE_URL ""
- | #define PACKAGE "extundelete"
- | #define VERSION "0.2.4"
- | /* end confdefs.h. */
- |
- | int
- | main ()
- | {
- |
- | ;
- | return 0;
- | }
- configure:2965: error: in `/root/extundelete-0.2.4‘:
- configure:2967: error: C++ compiler cannot create executables
- See `config.log‘ for more details
經過分析,發現其中的關鍵錯誤信息是:
g++: command not found
g++馬上就腦補為gc++的編譯器是不是沒有安裝呀? 估計是的,按圖索驥,安裝看看。
2. 安裝以及解決
由於本人使用的OS環境為centos, 其默認的包管理工具為yum, 故按照依賴包:
- yum -y update gcc
- yum -y install gcc+ gcc-c++
3. 總結分析
默認情況下,centos並未按照gcc相關的編譯命令,如果在安裝軟件之時,有時候需要從源代碼編譯開始,進行安裝;此時就需要gcc的命令支持。
【親測】<g++/gcc>CentOS下g++: command not found問題的解決(c++環境安裝)