How do I configure GCC, g++, and gdb in CentOS?

Source: Internet
Author: User

The use of GCC in Linux to compile C programs, using g++ to compile C + + programs, using GDB to debug the program, these tools need to install themselves, then how should you configure these tools?


First, enter VI on the command line to view the VIM information as follows:

650) this.width=650; "Width=" 397 "height=" 246 "title=" 1.png "style=" width:397px;height:232px; "src="/HTTP/ S3.51cto.com/wyfs02/m02/80/e6/wkiol1delv7c0mwqaabfdn0iat8353.png "alt=" Wkiol1delv7c0mwqaabfdn0iat8353.png "/>

Then, enter ls-a to see if there is a configuration file such as. VIMRC and. Viminfo, and the results are as follows:


650) this.width=650; "title=" 3.png "src=" Http://s3.51cto.com/wyfs02/M00/80/E8/wKiom1dELzTQPWUTAACCgxQcyuo014.png " alt= "Wkiom1delztqpwutaaccgxqcyuo014.png"/>


1. Configure GCC, g++

Using Yum in CentOS to configure GCC and g++, to install GCC, enter on the command line: yum-y install GCC, press ENTER to enable GCC installation, to install g++, you need to enter on the command line: yum-y install gcc-c++ , it is possible to install the g++.


650) this.width=650; "title=" 6.png "src=" Http://s1.51cto.com/wyfs02/M00/80/E8/wKiom1dEL-6i3fduAABd-ZY_SZU484.png " alt= "Wkiom1del-6i3fduaabd-zy_szu484.png"/>


2. Configure GDB

Here are the specific steps to configure GDB:

(1) In the Linux system, open the Web page http://ftp.gnu.org/gnu/gdb/, the following interface will appear:


650) this.width=650; "title=" 8.png "src=" Http://s4.51cto.com/wyfs02/M00/80/E6/wKioL1dEMmbxlLB5AAEGH_PZDOk716.png " alt= "Wkiol1demmbxllb5aaegh_pzdok716.png"/>


Here are some of the GDB tool's compressed packages, and then we select one of the versions to download, and here I choose the gdb-7.10 version. After downloading, use the LS command to view the downloaded file as follows:


650) this.width=650; "title=" 9.png "src=" Http://s5.51cto.com/wyfs02/M02/80/E6/wKioL1dEM7iTMC4MAAAaof5Y4XU228.png " alt= "Wkiol1dem7itmc4maaaaof5y4xu228.png"/>


(2) After downloading, the compressed file must be decompressed, in the command Window input: Tar xzvf gdb-7.10.tar.gz, after extracting, can see a file gdb-7.10:

650) this.width=650; "title=" 10.png "src=" http://s3.51cto.com/wyfs02/M00/80/E8/wKiom1dEMyPQ-Gk9AAAMxN2eysE911.png "alt=" Wkiom1demypq-gk9aaamxn2eyse911.png "/>


650) this.width=650; "title=" 11.png "src=" http://s4.51cto.com/wyfs02/M02/80/E8/wKiom1dEM0mywrG_AAA0ZpVgamU473.png "alt=" Wkiom1dem0mywrg_aaa0zpvgamu473.png "/>

(3) Enter the extracted directory: CD gdb-7.10


650) this.width=650; "title=" 12.png "src=" http://s4.51cto.com/wyfs02/M01/80/E6/wKioL1dENKyjsPeJAAATyJV_byU484.png "alt=" Wkiol1denkyjspejaaatyjv_byu484.png "/>

(4) Enter command:./configure, use Dir to view after completion


650) this.width=650; "title=" 13.png "src=" http://s1.51cto.com/wyfs02/M02/80/E6/wKioL1dENPXSCvL6AACK_5Z2aTM872.png "alt=" Wkiol1denpxscvl6aack_5z2atm872.png "/>


(5) Input command: make, compile gdb


650) this.width=650; "title=" 15.png "src=" http://s1.51cto.com/wyfs02/M00/80/E8/wKiom1dENKjwr4TxAAAMm5evYvg503.png "alt=" Wkiom1denkjwr4txaaamm5evyvg503.png "/>


(6) Then use: Make install, install GDB


650) this.width=650; "title=" 16.png "src=" http://s4.51cto.com/wyfs02/M01/80/E6/wKioL1dENgOjBtFCAAAcivgeNAs550.png "alt=" Wkiol1dengojbtfcaaacivgenas550.png "/>

(7) Use: Gdb-v view GDB version information to confirm the installation is correct


650) this.width=650; "title=" 17.png "src=" http://s1.51cto.com/wyfs02/M00/80/E6/wKioL1dENlORrOIKAAB8I_JXjmI261.png "alt=" Wkiol1denlorroikaab8i_jxjmi261.png "/>


The above is the configuration of GCC, g++, GDB, the main process, if strictly according to the above steps, generally will not have problems, GDB installation process a little bit of trouble, I hope the reader can be patient.




This article from "Unintentional persistent" blog, reproduced please contact the author!

How do I configure GCC, g++, and gdb in CentOS?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.