I'm learning linux system C++ During network development ,boost The installation of the library took me a lot of time . I will record my experience here , Facilitate learning and communication .
I'm learning linux In the process of development ,Centos And Ubuntu I use both systems . Both systems have their own software installers ：Centos by yum, and Ubuntu by apt-get. Personally , In the sense of use ,yum Slightly better than apt-get.
During software installation , It is best to use the installer provided with the system . The installer will automatically handle the related dependencies during software installation , If installed manually , Not only do you have to learn to deal with complex dependencies on your own , Software dependencies may also change in different periods , Most likely, the installation will fail .
Say back boost Installation of Library , stay Centos And Ubuntu Included in the self-contained software source boost library , Just install it directly ：
yum install boost yum install boost-devel yum install boost-doc
apt-cache search boost sudo apt-get install libboost-all-dev
C++ If necessary at compile time boost Library remember to use -lboost_system
Centos It can be used directly after installation ,Ubuntu When compiling, you will be prompted that it cannot be found boost library , Even if I will boost Manually joined the system path , It didn't solve the problem . Eventually only Centos Successfully installed .
If there is a big man who knows the solution, please leave a message .
<>gcc Upgrade of
stay Centos After installation , I tried to compile it C++ file , find auto Unrecognized type . Check the built-in gcc Version is 4.8, Too old , Not fully supported C++11 standard .
I use Centos7 system ,Centos7 In order to ensure the stability of the system , The software has adopted a lower version , Moreover, there is no new version available for updating in the built-in software source .
Finally, I manually added a new external software source , A new version of is installed gcc, And wrote a script , The new version is automatically when the terminal is opened gcc Compile as default .