ubuntu 安装g++

来源:互联网 发布:上海雅居乐万豪java 编辑:程序博客网 时间:2024/06/03 19:51

安装g++ 首先得安装gcc,一般Ubuntu 系统都会自带gcc,但是却没有g++,所以g++还是需要手动安装。这里我通过安装包的方式安装。关于gcc的安装可以点击这里here,我的Ubuntu是14.04版本的,gcc是4.8.4版本,所以下载了g++4.8.4版本的,下载地址点击这里here,我将安装需要的安装包都放到了/home/wl/Desktop/g++/目录下

root@ubuntu:/home/wl/Desktop/g++# ll -htotal 19Mdrwxr-xr-x 2 root root 4.0K Oct 27 11:55 ./drwxr-xr-x 4 wl   wl   4.0K Oct 27 11:42 ../-rw-r--r-- 1 root root  18M Oct 27 11:41 g++-4.8_4.8.4-2ubuntu1-14.04.3_amd64.deb-rw-r--r-- 1 root root 1.1M Oct 27 11:46 libstdc++-4.8-dev_4.8.4-2ubuntu1-14.04.3_amd64.deb-rw-r--r-- 1 root root 253K Oct 27 11:51 libstdc++6_4.8.4-2ubuntu1-14.04.3_amd64.debroot@ubuntu:/home/wl/Desktop/g++# 

不多说开始安装

root@ubuntu:/usr/pcre/pcre-8.31# dpkg -i /home/wl/Desktop/g++/g++-4.8_4.8.4-2ubuntu1-14.04.3_amd64.deb        Selecting previously unselected package g++-4.8.(Reading database ... 165202 files and directories currently installed.)Preparing to unpack .../g++-4.8_4.8.4-2ubuntu1-14.04.3_amd64.deb ...Unpacking g++-4.8 (4.8.4-2ubuntu1~14.04.3) ...dpkg: dependency problems prevent configuration of g++-4.8: g++-4.8 depends on libstdc++-4.8-dev (= 4.8.4-2ubuntu1~14.04.3); however:  Package libstdc++-4.8-dev is not installed.dpkg: error processing package g++-4.8 (--install): dependency problems - leaving unconfiguredProcessing triggers for man-db (2.6.7.1-1) ...Errors were encountered while processing: g++-4.8root@ubuntu:/usr/pcre/pcre-8.31#

报错了 : Package libstdc++-4.8-dev is not installed. 安装 libstdc++-4.8-dev

root@ubuntu:/usr/pcre/pcre-8.31# dpkg -i /home/wl/Desktop/g++/libstdc++-4.8-dev_4.8.4-2ubuntu1-14.04.3_amd64.deb Selecting previously unselected package libstdc++-4.8-dev:amd64.(Reading database ... 165241 files and directories currently installed.)Preparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1-14.04.3_amd64.deb ...Unpacking libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...dpkg: dependency problems prevent configuration of libstdc++-4.8-dev:amd64: libstdc++-4.8-dev:amd64 depends on libstdc++6 (>= 4.8.4-2ubuntu1~14.04.3); however:  Version of libstdc++6:amd64 on system is 4.8.2-19ubuntu1.dpkg: error processing package libstdc++-4.8-dev:amd64 (--install): dependency problems - leaving unconfiguredErrors were encountered while processing: libstdc++-4.8-dev:amd64root@ubuntu:/usr/pcre/pcre-8.31# 

报错:Version of libstdc++6:amd64 on system is 4.8.2-19ubuntu1 版本不够高,安装需要的版本

root@ubuntu:/usr/pcre/pcre-8.31# dpkg -i /home/wl/Desktop/g++/libstdc++6_4.8.4-2ubuntu1-14.04.3_amd64.deb        (Reading database ... 165977 files and directories currently installed.)Preparing to unpack .../libstdc++6_4.8.4-2ubuntu1-14.04.3_amd64.deb ...Unpacking libstdc++6:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...Setting up libstdc++6:amd64 (4.8.4-2ubuntu1~14.04.3) ...Processing triggers for libc-bin (2.19-0ubuntu6) ...root@ubuntu:/usr/pcre/pcre-8.31# 

成功 再次安装libstdc++-4.8-dev

root@ubuntu:/usr/pcre/pcre-8.31# dpkg -i /home/wl/Desktop/g++/libstdc++-4.8-dev_4.8.4-2ubuntu1-14.04.3_amd64.deb (Reading database ... 165989 files and directories currently installed.)Preparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1-14.04.3_amd64.deb ...Unpacking libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.4-2ubuntu1~14.04.3) ...Setting up libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...root@ubuntu:/usr/pcre/pcre-8.31# 

成功 最后安装 g++-4.8.4

root@ubuntu:/usr/pcre/pcre-8.31# dpkg -i /home/wl/Desktop/g++/g++-4.8_4.8.4-2ubuntu1-14.04.3_amd64.deb (Reading database ... 165989 files and directories currently installed.)Preparing to unpack .../g++-4.8_4.8.4-2ubuntu1-14.04.3_amd64.deb ...Unpacking g++-4.8 (4.8.4-2ubuntu1~14.04.3) over (4.8.4-2ubuntu1~14.04.3) ...Setting up g++-4.8 (4.8.4-2ubuntu1~14.04.3) ...Processing triggers for man-db (2.6.7.1-1) ...root@ubuntu:/usr/pcre/pcre-8.31#

成功,查看g++ 版本

root@ubuntu:/usr/pcre/pcre-8.31# g++ --versiong++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4Copyright (C) 2013 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.root@ubuntu:/usr/pcre/pcre-8.31# 

本文中用到的安装包下载地址

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 眼睛干涩有红血丝怎么办 小孩子眼睛红有眼屎怎么办 狗狗的肉垫粗糙怎么办 狗狗眼睛变蓝色怎么办 脸被太阳晒伤了怎么办 皮肤晒伤红肿痒怎么办 3岁儿童频繁眨眼怎么办 狗狗的眼睛红肿怎么办 脸过敏发红怎么办不痒 上眼皮红肿痒是怎么办 眼睛痒了几天了怎么办 眼睛肿了还痒怎么办 孩子脸上有红血丝怎么办 脸上长了红血丝怎么办 指甲受创出血了怎么办 手指被挤压紫了怎么办 眼睛撞了有淤血怎么办 下眼底有小白点怎么办 狗的白眼球充血怎么办 眼球有出血点是怎么办 吃阿胶上火了该怎么办 胎儿胼胝体发育不良怎么办 鸡眼看到硬芯了怎么办 小脚趾起茧子疼怎么办 脚起老茧很痛怎么办 化疗后骨髓抑制严重怎么办 胃炎引起的胃胀怎么办 胃病胀肚子很鼓怎么办 小孩淋巴结发炎肚子疼痛怎么办 顺产后子宫脱垂怎么办 顺产完子宫脱垂怎么办 额头长了个鱼鳞怎么办 脸上长了很多痣怎么办 做过狐臭的疤痕怎么办 痤疮留下的红印怎么办 脸上疤掉了黑印怎么办 脸上有黑色的疤怎么办 一只眼睛外斜视怎么办 残币银行不给换怎么办 手上有多套房的怎么办 长了两层脚指甲怎么办