Installation Method
Automatic Installation
Yum Install gcc (this is)
yum install gcc-c++ (this is the C + + compiler)
Yum install
However, this does not install the specified version to install only the version of the system disk, the following CentOS 6x64 install GCC 4.8.4 For example, Custom install 1. Install gcc4.8.4 for small white (actually I am one)
The following CD XX means to enter a directory by default in the root directory
Cd.. Or ' represents a return to the root directory
Wget means to get a download from the network location 1 Download Source
Wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.4/gcc-4.8.4.tar.bz2 (You can change the version number here according to different needs)
2) Unzip and download the project required for compiling
TAR-JXVF gcc-4.8.4.tar.bz2
cd gcc-4.8.4
./contrib/download_prerequisites
CD. (Back to the root directory here. Can be replaced by a space)
3 Generate directories and makefile and compile
mkdir gcc-build-4.8.4 (Create a directory under Root to store)
CD gcc-build-4.8.4
. /gcc-4.8.4/configure--enable-checking=release--enable-languages=c,c++--disable-multilib
make-j4 (* After this step is a long wait ~ do not think it is the crash ... *
4) Installation
sudo make install
5) Check version number
GCC--version or-v
Using built-in specs.
COLLECT_GCC=GCC
Collect_lto_wrapper=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.4/lto-wrapper
Target:x86_64-unknown-linux-gnu
Configured with:. /configure--enable-checking=release--enable-languages=c,c++--disable-multilib
Thread model:posix
gcc Version 4.8.4 (GCC)
2. Install CMake
1) Get Source ditto
Wget http://www.cmake.org/files/v3.4.2/cmake-3.4.2.tar.gz (now updated to 3.5 according to individual needs, this version is relatively stable)
2) Decompression and access to the directory
TAR-ZXVF cmake-3.4.2.tar.gz
CD cmake-3.4.2
3 Important and easily error-prone parts
./bootstrap
Error 1
Gmake: "CMake" is up to date.
/home/src/cmake-2.8.12.2/bootstrap.cmk/cmake:/usr/lib64/libstdc++.so.6:version ' GLIBCXX_3.4.15 ' not found ( Required By/home/src/cmake-2.8.12.2/bootstrap.cmk/cmake)
try to run
strings/usr/lib/libstdc++.so.6 | grep Glibcxx
glibcxx_3.4
glibcxx_3.4.1
glibcxx_3.4.2
glibcxx_3.4.3
glibcxx_3.4.4 glibcxx_3.4.5
glibcxx_3.4.6
glibcxx_3.4.7
glibcxx_3.4.8
glibcxx_3.4.9
glibcxx_3.4.10
glibcxx_3.4.11
glibcxx_3.4.12
glibcxx_3.4.13
glibcxx_force_new
glibcxx_debug_message_length
this as libstdc++. So.6 version of the lower caused
getting from the network
Wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_i386.deb (Get On Demand)
tar-x libstdc+ +6_4.7.2-5_i386.deb && tar xvf data.tar.gz
start with GCC just installed
Along the GCC installation path, we found the new libstdc++:
strings/usr/local/lib64/libstdc++.so.6.0.20|grep glibcxx (here 6. Later depending on the version)
glibcxx_3.4
glibcxx_3.4.1
glibcxx_3.4.2
glibcxx_3.4.3
glibcxx_3.4.4
glibcxx_3.4.5 glibcxx_3.4.6
glibcxx_3.4.7
glibcxx_3.4.8
glibcxx_3.4.9
glibcxx_3.4.10
glibcxx_3.4.11
glibcxx_3.4.12
glibcxx_3.4.13
glibcxx_3.4.14
glibcxx_3.4.15
glibcxx_3.4.16
glibcxx_3.4.17
glibcxx_ 3.4.18
glibcxx_3.4.19
glibcxx_3.4.20
glibcxx_force_new
glibcxx_debug_message_length
Well, there's a combination of requirements, the first two to continue .
cp/usr/local/lib/libstdc++.so.6.0.20 /usr/lib/(copied to usr directory)
cd/usr/lib/(to this directory)
rm-f libstdc++.so.6 (delete old Lib)
Ln-s libstdc++.so.6.0.20 libstdc++.so.6 (re-establish link)
strings/usr/lib/libstdc++.so.6 | grep Glibcxx (View again)
Note that the directories under LIB64 will also be updated. Here no longer repeat the change suffix can error 2
Error when bootstrapping CMake:
cannot find appropriate C (or C + +) compiler on this system.
Please specify one using environment variable CC.
Cmake_bootstrap.log for compilers attempted.
Lack of a suitable C + + compiler, you should be concerned about whether the version of GCC matches, in this case, should be matched. ~ 4) Subsequent installation
Gmake
gmake Install
cmake--version
3. Verify
fir.cc
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello world!" <<endl;
return 0;
}
CMD input
g++-std=c++11-o fir fir.cc
./fir.cc (if unable to run the description does not provide permissions plus permissions chmod +x)