linux升級gcc的方法執行個體

來源:互聯網
上載者:User
GCC的初衷是為GNU作業系統專門編寫的一款編譯器。GNU系統是徹底的自由軟體。此處,"自由"的含義是它尊重使用者的自由。本文主要和大家分享linux升級gcc的方法執行個體,希望能協助到大家。

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2tar -jxvf gcc-4.8.2.tar.bz2

建立一個目錄供編譯出的檔案存放

mkdir gcc-build-4.8.2cd gcc-build-4.8.2

產生Makefile檔案

../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

編譯(注意:此步驟非常耗時)

make -j4

make -j4

sudo make install

重啟,然後查看gcc版本gcc -v寫一個C++11特性的程式段 test.cpp,使用了shared_ptr

//test.cpp#include #include using namespace std;int main(){      shared_ptr pInt(new int(10));      cout < < *pInt << endl;      return 0;}

驗證

g++ -std=c++11 -o test test.cpp./test

如果找不到libstdc++.so.6中的GLIBCXX_3.4.15,請執行下面命令

cp /usr/local/lib64/libstdc++.so.6.0.18 /usr/lib64rm -rf /usr/lib64/libstdc++.so.6ln -s /usr/lib64/libstdc++.so.6.0.18 /usr/lib64/libstdc++.so.6

查看是否連結上

ll /usr/lib64/libstdc++.so.6lrwxrwxrwx 1 root root 19  9月 29 12:48 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.18

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.