Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade GCC under Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to upgrade GCC under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The GCC compiler is the most commonly used Linux Calgary + compiler, which is installed by default in most Linux distributions, but the default version of the system is too low.

Easy installation

Get the installation package and extract it

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

Of course, all the gcc versions are available for download in http://ftp.gnu.org/gnu/gcc, and the latest version is 4.9.2. Download the dependencies for compiling requirements. This magical script file will help us download, configure, and install dependent libraries, saving us a lot of time and effort.

Cd gcc-4.8.2. / contrib/download_prerequisites

Create a directory for compiled files to store

Mkdir gcc-build-4.8.2cd gcc-build-4.8.2

Generate Makefile file

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

Compile (Note: this step is very time-consuming)

Make-J4

The-j4 option is make's optimization of multicore processors.

Installation

Sudo make install verifies installation

Restart and check the gcc version

Gcc-v

Write a program segment test.cpp with the feature of Clippers 11, using shared_ptr

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

Verification

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

If you cannot find the GLIBCXX_3.4.15 in libstdc++.so.6, execute the following command

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

Check to see if there is a link

Ll / usr/lib64/libstdc++.so.6lrwxrwxrwx 1 root root 19 September 29 12:48 / usr/lib64/libstdc++.so.6-> libstdc++.so.6.0.18 Thank you for reading! This is the end of this article on "how to upgrade GCC under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report