sureshmsi.co.nr

  • co.nr

Archive for the ‘BSD’ Category

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.
wget http://cudlug.cudenver.edu/GNU/gnu/gcc/gcc-3.4.3/gcc-3.4.3.tar.bz2
wget http://cudlug.cudenver.edu/GNU/gnu/gcc/gcc-3.4.3/gcc-core-3.4.3.tar.bz2

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

Posted in BSD, Linux, Technical | Tagged: , , , , , , , , , | Leave a Comment »