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 build C++ Development Environment in Ubuntu Environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to build a C++ development environment in the Ubuntu environment". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a C++ development environment in the Ubuntu environment".

This article introduces the method of compiling the latest GCC compiler in the latest Ubuntu20.04 environment. Using this environment, you can learn the new features of Category 20.

Install Ubuntu20.04

Download the latest installation package from the Ubuntu website and install it. The specific address can be searched by yourself, or you can refer to the link at the end of the article.

Install the compilation environment

Update the Ubuntu installation package information:

$sudo apt update

Install the compilation feature pack

$sudo apt install build-essential

Installation and development documentation

$sudo apt-get install manpages-dev

Confirm the gcc version

$gcc-version

The author's environment shows that the current version of gcc is 9.3.

Install Git

Install the Git package

$sudo apt install git

Confirm the Git version

$git-version

The author's environment is shown as follows:

Download the GCC source code

Download the code from the gcc website to the src directory.

Git clone git://gcc.gnu.org/git/gcc.git src

Start downloading.

The process will last for several hours. Wait slowly.

Configure the GCC compilation environment

In addition, create a directory where the compilation results are stored, and execute configuration commands in this directory. First prepare the mpc development library:

Apt-get install libmpc-dev

Install flex

$sudo apt-get install flex

Configure the compilation environment (64bit environment requires the use of-- disable-multilibx)

$.. / src/configure-- disable-multilib

Compile GCC

$make

Wait again.

Install GCC

$sudo make install

GCC version switching

Use the following command to add gcc version switching options (gcc9 and newly compiled gcc11 are added in the example)

$sudo update-alternatives-- install / usr/bin/gcc gcc / usr/bin/x86_64-linux-gnu-gcc-9 90$ sudo update-alternatives-- install / usr/bin/gcc gcc / usr/local/bin/x86_64-pc-linux-gnu-gcc

Confirm the gcc option

$sudo update-alternatives-config gcc

The output of the author's environment is as follows:

You can switch the gcc version by pressing the enter key or the number key.

Confirm the switching result

$gcc-version

The output of the environment used by the author is as follows:

The great task has been completed!

Thank you for your reading, the above is the content of "how to build a C++ development environment in the Ubuntu environment". After the study of this article, I believe you have a deeper understanding of how to build a C++ development environment in the Ubuntu environment. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report