先安装gcc;需要root权限;

切换到root用户;命令:sudo su;再输入密码;

切换到root用户;命令:yum install gcc;安装失败;

带 -y 再运行;安装成功;过程如下;gcc -v,查看版本;

[root@localhost /]# yum -y install gcc
Loaded plugins: fastestmirror, langpacks
base                                                     | 3.6 kB     00:00     
extras                                                   | 2.9 kB     00:00     
updates                                                  | 2.9 kB     00:00     
(1/3): base/7/x86_64/group_gz                              | 165 kB   00:01     
(2/3): extras/7/x86_64/primary_db                          | 164 kB   00:01     
(3/3): base/7/x86_64/primary_db                            | 6.0 MB   00:11     
Determining fastest mirrors
 * base: mirrors.163.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: libgomp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: libgcc >= 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-39.el7.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-39.el7 will be installed
---> Package libgcc.x86_64 0:4.8.2-16.el7 will be updated
---> Package libgcc.x86_64 0:4.8.5-39.el7 will be an update
---> Package libgomp.x86_64 0:4.8.2-16.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-39.el7 will be an update
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch             Version                Repository      Size
================================================================================
Installing:
 gcc               x86_64           4.8.5-39.el7           base            16 M
Installing for dependencies:
 cpp               x86_64           4.8.5-39.el7           base           5.9 M
 libmpc            x86_64           1.0.1-3.el7            base            51 k
Updating for dependencies:
 libgcc            x86_64           4.8.5-39.el7           base           102 k
 libgomp           x86_64           4.8.5-39.el7           base           158 k

Transaction Summary
================================================================================
Install  1 Package  (+2 Dependent packages)
Upgrade             ( 2 Dependent packages)

Total download size: 22 M
Downloading packages:
No Presto metadata available for base
warning: /var/cache/yum/x86_64/7/base/packages/libgcc-4.8.5-39.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for libgcc-4.8.5-39.el7.x86_64.rpm is not installed
(1/5): libgcc-4.8.5-39.el7.x86_64.rpm                      | 102 kB   00:00     
(2/5): libmpc-1.0.1-3.el7.x86_64.rpm                       |  51 kB   00:01     
(3/5): libgomp-4.8.5-39.el7.x86_64.rpm                     | 158 kB   00:01     
(4/5): cpp-4.8.5-39.el7.x86_64.rpm                         | 5.9 MB   00:21     
(5/5): gcc-4.8.5-39.el7.x86_64.rpm                         |  16 MB   00:33     
--------------------------------------------------------------------------------
Total                                              679 kB/s |  22 MB  00:33     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-0.1406.el7.centos.2.3.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libmpc-1.0.1-3.el7.x86_64                                    1/7 
  Installing : cpp-4.8.5-39.el7.x86_64                                      2/7 
  Updating   : libgomp-4.8.5-39.el7.x86_64                                  3/7 
  Updating   : libgcc-4.8.5-39.el7.x86_64                                   4/7 
  Installing : gcc-4.8.5-39.el7.x86_64                                      5/7 
  Cleanup    : libgomp-4.8.2-16.el7.x86_64                                  6/7 
  Cleanup    : libgcc-4.8.2-16.el7.x86_64                                   7/7 
  Verifying  : libgcc-4.8.5-39.el7.x86_64                                   1/7 
  Verifying  : libgomp-4.8.5-39.el7.x86_64                                  2/7 
  Verifying  : libmpc-1.0.1-3.el7.x86_64                                    3/7 
  Verifying  : cpp-4.8.5-39.el7.x86_64                                      4/7 
  Verifying  : gcc-4.8.5-39.el7.x86_64                                      5/7 
  Verifying  : libgomp-4.8.2-16.el7.x86_64                                  6/7 
  Verifying  : libgcc-4.8.2-16.el7.x86_64                                   7/7

Installed:
  gcc.x86_64 0:4.8.5-39.el7

Dependency Installed:
  cpp.x86_64 0:4.8.5-39.el7             libmpc.x86_64 0:1.0.1-3.el7

Dependency Updated:
  libgcc.x86_64 0:4.8.5-39.el7           libgomp.x86_64 0:4.8.5-39.el7

Complete!
[root@localhost /]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
[root@localhost /]#

安装 gcc-c++ ;过程如下;

[root@localhost lixbo1]# yum -y install gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-39.el7 for package: gcc-c++-4.8.5-39.el7.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-39.el7 for package: gcc-c++-4.8.5-39.el7.x86_64
--> Running transaction check
---> Package libstdc++.x86_64 0:4.8.2-16.el7 will be updated
---> Package libstdc++.x86_64 0:4.8.5-39.el7 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.5-39.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch           Version              Repository    Size
================================================================================
Installing:
 gcc-c++                 x86_64         4.8.5-39.el7         base         7.2 M
Installing for dependencies:
 libstdc++-devel         x86_64         4.8.5-39.el7         base         1.5 M
Updating for dependencies:
 libstdc++               x86_64         4.8.5-39.el7         base         305 k

Transaction Summary
================================================================================
Install  1 Package  (+1 Dependent package)
Upgrade             ( 1 Dependent package)

Total download size: 9.0 M
Downloading packages:
No Presto metadata available for base
(1/3): libstdc++-4.8.5-39.el7.x86_64.rpm                   | 305 kB   00:02     
(2/3): libstdc++-devel-4.8.5-39.el7.x86_64.rpm             | 1.5 MB   00:03     
(3/3): gcc-c++-4.8.5-39.el7.x86_64.rpm                     | 7.2 MB   00:10     
--------------------------------------------------------------------------------
Total                                              905 kB/s | 9.0 MB  00:10     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libstdc++-4.8.5-39.el7.x86_64                                1/4 
  Installing : libstdc++-devel-4.8.5-39.el7.x86_64                          2/4 
  Installing : gcc-c++-4.8.5-39.el7.x86_64                                  3/4 
  Cleanup    : libstdc++-4.8.2-16.el7.x86_64                                4/4 
  Verifying  : gcc-c++-4.8.5-39.el7.x86_64                                  1/4 
  Verifying  : libstdc++-devel-4.8.5-39.el7.x86_64                          2/4 
  Verifying  : libstdc++-4.8.5-39.el7.x86_64                                3/4 
  Verifying  : libstdc++-4.8.2-16.el7.x86_64                                4/4

Installed:
  gcc-c++.x86_64 0:4.8.5-39.el7

Dependency Installed:
  libstdc++-devel.x86_64 0:4.8.5-39.el7

Dependency Updated:
  libstdc++.x86_64 0:4.8.5-39.el7

Complete!
[root@localhost lixbo1]# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
[root@localhost lixbo1]#

安装gdb,过程如下;

[root@localhost lixbo1]# yum -y install gdb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package gdb.x86_64 0:7.6.1-51.el7 will be updated
---> Package gdb.x86_64 0:7.6.1-115.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                   Arch                         Version                              Repository                  Size
==============================================================================================================================
Updating:
 gdb                       x86_64                       7.6.1-115.el7                        base                       2.4 M

Transaction Summary
==============================================================================================================================
Upgrade  1 Package

Total download size: 2.4 M
Downloading packages:
No Presto metadata available for base
gdb-7.6.1-115.el7.x86_64.rpm                                                                           | 2.4 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : gdb-7.6.1-115.el7.x86_64                                                                                   1/2 
  Cleanup    : gdb-7.6.1-51.el7.x86_64                                                                                    2/2 
  Verifying  : gdb-7.6.1-115.el7.x86_64                                                                                   1/2 
  Verifying  : gdb-7.6.1-51.el7.x86_64                                                                                    2/2

Updated:
  gdb.x86_64 0:7.6.1-115.el7

Complete!
[root@localhost lixbo1]#

安装git;过程如下;

[root@localhost lixbo1]# yum -y install git
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-21.el7_7 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-21.el7_7 for package: git-1.8.3.1-21.el7_7.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-21.el7_7.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-21.el7_7.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-21.el7_7.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-21.el7_7 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                           Arch                    Version                             Repository                Size
==============================================================================================================================
Installing:
 git                               x86_64                  1.8.3.1-21.el7_7                    updates                  4.4 M
Installing for dependencies:
 perl-Error                        noarch                  1:0.17020-2.el7                     base                      32 k
 perl-Git                          noarch                  1.8.3.1-21.el7_7                    updates                   55 k
 perl-TermReadKey                  x86_64                  2.30-20.el7                         base                      31 k

Transaction Summary
==============================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 4.5 M
Installed size: 22 M
Downloading packages:
(1/4): perl-Error-0.17020-2.el7.noarch.rpm                                                             |  32 kB  00:00:01     
(2/4): perl-Git-1.8.3.1-21.el7_7.noarch.rpm                                                            |  55 kB  00:00:01     
(3/4): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                                         |  31 kB  00:00:01     
(4/4): git-1.8.3.1-21.el7_7.x86_64.rpm                                                                 | 4.4 MB  00:00:06     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         671 kB/s | 4.5 MB  00:00:06     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:perl-Error-0.17020-2.el7.noarch                                                                          1/4 
  Installing : perl-TermReadKey-2.30-20.el7.x86_64                                                                        2/4 
  Installing : perl-Git-1.8.3.1-21.el7_7.noarch                                                                           3/4 
  Installing : git-1.8.3.1-21.el7_7.x86_64                                                                                4/4 
  Verifying  : git-1.8.3.1-21.el7_7.x86_64                                                                                1/4 
  Verifying  : 1:perl-Error-0.17020-2.el7.noarch                                                                          2/4 
  Verifying  : perl-Git-1.8.3.1-21.el7_7.noarch                                                                           3/4 
  Verifying  : perl-TermReadKey-2.30-20.el7.x86_64                                                                        4/4

Installed:
  git.x86_64 0:1.8.3.1-21.el7_7

Dependency Installed:
  perl-Error.noarch 1:0.17020-2.el7       perl-Git.noarch 0:1.8.3.1-21.el7_7       perl-TermReadKey.x86_64 0:2.30-20.el7

Complete!
[root@localhost lixbo1]#

安装vim插件;未成功;

[root@localhost lixbo1]# git clone https://gitee.com/chxuan/vimplus.git ~/.vimplus
Cloning into '/root/.vimplus'...
remote: Enumerating objects: 163, done.
remote: Counting objects: 100% (163/163), done.
remote: Compressing objects: 100% (161/161), done.
remote: Total 2191 (delta 95), reused 0 (delta 0), pack-reused 2028
Receiving objects: 100% (2191/2191), 12.68 MiB | 492.00 KiB/s, done.
Resolving deltas: 100% (1354/1354), done.
[root@localhost lixbo1]# cd ~/.vimplus
[root@localhost .vimplus]# dir
autoload  fonts     help.md    install_to_user.sh  README.md     uninstall.sh
colors      ftplugin  install.sh    LICENSE            screenshots  update.sh
[root@localhost .vimplus]# ./install.sh
Platform type: Linux
Linux distro: CentOS
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 8969.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 166 M RSS (569 MB VSZ)
    Started: Thu Mar 26 22:25:37 2020 - 08:47 ago
    State  : Sleeping, pid: 8969
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 166 M RSS (569 MB VSZ)
    Started: Thu Mar 26 22:25:37 2020 - 08:49 ago
    State  : Sleeping, pid: 8969
一直出 Another app is currently holding the yum lock ;下回再搞;

构建C++ hello world 程序;成功;

CentOS搭建C++开发环境相关推荐

  1. 在CentOS搭建Android开发环境

    JDK安装 没选用CentOS自带的Java环境,下载Oracle最新版本的java,下载地址为http://www.oracle.com/technetwork/ja...sp-136632.htm ...

  2. 在CentOS 6.2上搭建vim开发环境

    在CentOS 6.2上搭建vim开发环境 最后更新日期:2013-07-05 1.首先使用Ubuntu(所在ip为192.168.16.230)翻墙登陆http://www.vim.org/,下载其 ...

  3. 7 centos 源码安装samba_CentOS搭建WonderTrader开发环境及v0.5.4版本发布

    前言 之前发过一篇关于如何搭建WonderTrader开发环境的文章<从零搭建WonderTrader的开发环境>,帮助不少用户解决了一些编译源码的问题.因为笔者是在Ubuntu 18.0 ...

  4. CentOS下C++开发环境搭建

    CentOS下C++开发环境搭建 vimplus github 我的环境 CentOS 7.5 64位 环境部署 vim 编辑工具 g++ 编译器 git 版本控制 gdb 调试工具 cmake 跨平 ...

  5. 一天一点linux(9):ubuntu下如何搭建LAMP开发环境?

    功能介绍 上一次搭建Linux下LAMP环境是基于的CentOS6.7版本,采取的方式是源码编译安装,折腾了好久才在CentOS下,把LAMP环境给搭建起来,而Ubuntu作为现在主流的Linux版本 ...

  6. 利用vagrant快速搭建rails开发环境

    为什么80%的码农都做不了架构师?>>>    Deprecated 前言 当我们学习一门新的语言或技术的时候,最麻烦或比较浪费时间的事情就是搭建开发环境.而搭建开发环境与我们将要学 ...

  7. docker配置python环境_PyCharm使用Docker镜像搭建Python开发环境

    在我们平时使用PyCharm的过程中,一般都是连接本地的Python环境进行开发,但是如果是离线的环境呢?这样就不好搭建Python开发环境,因为第三方模块的依赖复杂,不好通过离线安装包的方式安装.本 ...

  8. 从零开始vim搭建Java开发环境[视频]

    视频教程 从零开始vim搭建Java开发环境 全屏观看 前言 起初我仅仅是想在手机上搭建一套能开发Java的vim环境.<玩转手机中的linux系统termux并搭建java开发环境> 玩 ...

  9. 搭建 dicom 开发环境

    搭建 dicom 开发环境 搭建 dcm4chee-arc-light (可选) 准备vagrant 准备docker dcm4che/dcm4chee-arc-light dicom 开发环境 编译 ...

最新文章

  1. Callgrind--函数调用分析工具以及可视化方法
  2. 【 Linux 】Linux下如何退出vim的一些常用命令总结
  3. 线性代数 第一章 行列式
  4. 推荐10款来自极客标签的超棒前端特效[第五期]
  5. Docker端口映射实现
  6. nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
  7. linux的驱动开发——简单驱动程序编写
  8. RandomAccessFile读写txt文件中文乱码
  9. OpenGL基础9:纹理
  10. Spring Cloud分布式微服务系统中利用redssion实现分布式锁
  11. Windows内核之系统架构
  12. 偶遇 649453.sys / Adware.Cdn / Hacktool.Rootkit
  13. 还原永恒之蓝下载器PS脚本混淆
  14. 抖音弹幕解析过程 PB数据转json 解决乱码 所有语言通用思路
  15. 账单php,php 处理微信账单
  16. Python绘制3D图形:Axes3D
  17. 信奥中的数学:排列组合
  18. 小白如何上手几款微信小程序UI组件库
  19. GCC源代码分析(1): GCC中的树
  20. RedHat Linux 9.0 安装教程(全程图解)

热门文章

  1. explain 之 select_type
  2. Python 【微视】短视频的自动上传与发布实例演示,同时支持抖音、快手、哔哩哔哩、小红书、西瓜视频、微信视频号等平台的视频自动化同步发布
  3. 二叉树的前序中序后序递归查找,深度,广度搜索C++实现(VS2017)
  4. C# 学习笔记(5) 继承
  5. CTFshow 命令执行 web55
  6. CTFshow 信息收集 web1
  7. 第十一周项目实践3 DFS(深度优先搜索)的基本模板
  8. [YTU]_2637(编程题:类---矩形类)
  9. MATLAB编程练习题
  10. matlab中fill函数的使用方法