系统环境:

开发环境使用的是 Centos7.6 ,要支持 c++11.

VIM 安装

使用了C++11,所以必须使用VIM7.4 以上的版本才能正常显示C++11中的一些语法(lambda)

#安装依赖
yum install wget
yum install ncurses-devel
yum install gcc gcc-c++
yum install ctags
yum install bzip2

wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
tar xvf vim-8.1.tar.bz2
cd vim81
./configure
make -j4
make install
#验证安装成功
which vim

GCC安装

并且c++11需要gcc4.8以上版本支持,因此需要下载gcc4.8以上版本以支持c++11,这次是使用 gcc 9.1 版本,使用源码的方式进行编译的。
gcc 9.1 完整支持C++11,C++14,C++17,而且错误提示更友好。

GCC 9.1 依赖软件安装:

autoconf 软件安装

gcc安装需要依赖automake-1.15以上版本,automake-1.15以上版本,需要依赖autoconf 2.69
下载地址:http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make -j4
make install

#验证安装成功
which autoconf

automake 软件安装

gcc安装需要依赖automake-1.15以上版本
下载地址:http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz

wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
tar xvf automake-1.15.tar.gz
cd automake-1.15
./configure
#修改Makefile 查找 /doc/automake-$(APIVERSION)
#doc/automake-$(APIVERSION).1: $(automake_script) lib/Automake/Config.pm
# $(update_mans) automake-$(APIVERSION) --no-discard-stderr
#(3686行,加上--no-discard-stderr)
make -j4
make install
#验证安装成功
which automake

GCC正式安装

GCC安装的时间会比较长,大概几个小时,取决于机器性能,需要耐心等待。

wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-9.1.0/gcc-9.1.0.tar.xz
tar xvJf gcc-9.1.0.tar.xz
cd gcc-9.1.0
sh contrib/download_prerequisites
mkdir build
cd build
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4
make install

#验证安装成功
which gcc

GDB安装

linux下调试工具, 版本8.3
由于8.3版本需要依赖gcc支持c++11,gdb必须等gcc安装完之后再安装

下载地址:http://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.xz

wget http://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.xz
tar xvf gdb-8.3.tar.xz
cd gdb-8.3
./configure
make -j4
make install

#验证安装成功
which gdb

CMake安装

使用的版本是CMake3.14.5
下载地址:https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gz

wget https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gz
tar xvf cmake-3.14.5.tar.gz
cd cmake-3.14.5
./configure
make -j4
make install

#验证安装成功
which cmake

这样就可以C、C++ linux 的开发就可以了。

特别说明一下 ohmyzsh

shell的类型有很多种,linux下默认的是bash,虽然bash的功能已经很强大,但对于以懒惰为美德的程序员来说,bash的提示功能不够强大,界面也不够炫,并非理想工具。

而zsh的功能极其强大,只是配置过于复杂,起初只有极客才在用。后来,有个穷极无聊的程序员可能是实在看不下去广大猿友一直只能使用单调的bash, 于是他创建了一个名为oh-my-zsh的

在这里抛个砖,需要的大家自行搜索安装

yum install zsh
yum install git
sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”