How to install the GNU C++ compiler on Linux

Posted by sureshm on October 27, 2007

Now a days there are lot of easy tools/commands for the installation in Linux. The most commonly used are yum, apt-get, urpmi etc.

The below will help you to install GNU C++ complier using the source file. Please make sure that you have root (wheel user) privilege in the machine in order to have write access to the referenced directories.

01. Create a directory named gcc under /usr
mkdir /usr/gcc

02. Download the following files by running the command as follows.

03. Uncompress the two files.
tar xjvf gcc-g++-3.4.3.tar.bz2 ; tar xjvf gcc-core-3.4.3.tar.bz2

04. Then do the following commands.
rm -rf /usr/gcc/obj/* ; mkdir /usr/gcc/obj ; cd /usr/gcc/obj

05. Run the configure with the options C and C++
../gcc-3.4.3/configure -enable-languages=c,c++

06. Make it
make bootstrap ; make install

That’s all.
Verify it with the following commands.
To know the path :
which g++

To know the version:
g++ -v


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: