在ubuntu中安装c ++ [英] installing c++ in ubuntu

查看:185
本文介绍了在ubuntu中安装c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7和Windows 7上都安装了ubuntu 12.04.我打算在ubuntu中安装c ++,但是由于我的互联网连接缓慢而无法安装.软件索引无法更新.
然后我从Windows转到packages.ubuntu.com,并在网站上查找了g ++.我下载了.deb软件包以及所有依赖项.我将它们全部保存在同一文件夹中.
然后,我在ubuntu中启动了终端,并切换到保存所有软件包的目录.然后在终端上键入以下命令:

I have ubuntu 12.04 installed on my system alongside Windows 7. I set about installing c++ in ubuntu, but was unable to do so because of my slow internet connection; the software index could not be updated.
Then I went to packages.ubuntu.com from windows and looked up g++ on the website. I downloaded the .deb package along with all the dependencies. I saved them all in the same folder.
Then I started the terminal in ubuntu and changed to the directory where all the packages were saved. Then I typed the following command on my terminal:

sudo dpkg -i g++-4.6_4.6.3-1ubuntu5_amd64.deb gcc-4.6_4.6.3-1ubuntu5_amd64.deb gcc-4.6-base_4.6.3-1ubuntu5_amd64.deb libc6_2.15-0ubuntu10_amd64.deb libgmp10_5.0.2+dfsg-2ubuntu1_amd64.deb libmpc2_0.9-4_amd64.deb libmpfr4_3.1.0-3ubuntu2_amd64.man libstdc++6-4.6-dev_4.6.3-1ubuntu5_amd64.deb zlib1g_1.2.3.4.dfsg-3ubuntu4_amd64.deb gcc-4.6-doc_4.6.3-1ubuntu5_all.deb



我在终端上得到了以下结果:



I got the following result on my terminal:

(Reading database ... 140686 files and directories currently installed.)
Preparing to replace g++-4.6 4.6.3-1ubuntu5 (using g++-4.6_4.6.3-1ubuntu5_amd64.deb) ...
Unpacking replacement g++-4.6 ...
Preparing to replace gcc-4.6 4.6.3-1ubuntu5 (using gcc-4.6_4.6.3-1ubuntu5_amd64.deb) ...
Unpacking replacement gcc-4.6 ...
Preparing to replace gcc-4.6-base 4.6.3-1ubuntu5 (using gcc-4.6-base_4.6.3-1ubuntu5_amd64.deb) ...
Unpacking replacement gcc-4.6-base ...
Preparing to replace libc6 2.15-0ubuntu10 (using libc6_2.15-0ubuntu10_amd64.deb) ...
Unpacking replacement libc6 ...
Preparing to replace libgmp10 2:5.0.2+dfsg-2ubuntu1 (using libgmp10_5.0.2+dfsg-2ubuntu1_amd64.deb) ...
Unpacking replacement libgmp10 ...
Preparing to replace libmpc2 0.9-4 (using libmpc2_0.9-4_amd64.deb) ...
Unpacking replacement libmpc2 ...
Preparing to replace libmpfr4 3.1.0-3ubuntu2 (using libmpfr4_3.1.0-3ubuntu2_amd64.man) ...
Unpacking replacement libmpfr4 ...
Preparing to replace libstdc++6-4.6-dev 4.6.3-1ubuntu5 (using libstdc++6-4.6-dev_4.6.3-1ubuntu5_amd64.deb) ...
Unpacking replacement libstdc++6-4.6-dev ...
Preparing to replace zlib1g 1:1.2.3.4.dfsg-3ubuntu4 (using zlib1g_1.2.3.4.dfsg-3ubuntu4_amd64.deb) ...
Unpacking replacement zlib1g ...
Preparing to replace gcc-4.6-doc 4.6.3-1ubuntu5 (using gcc-4.6-doc_4.6.3-1ubuntu5_all.deb) ...
Unpacking replacement gcc-4.6-doc ...
Setting up gcc-4.6-base (4.6.3-1ubuntu5) ...
Setting up libc6 (2.15-0ubuntu10) ...
Setting up libgmp10 (2:5.0.2+dfsg-2ubuntu1) ...
Setting up libmpfr4 (3.1.0-3ubuntu2) ...
Setting up zlib1g (1:1.2.3.4.dfsg-3ubuntu4) ...
Setting up gcc-4.6-doc (4.6.3-1ubuntu5) ...
Setting up libmpc2 (0.9-4) ...
Setting up gcc-4.6 (4.6.3-1ubuntu5) ...
Processing triggers for man-db ...
Setting up g++-4.6 (4.6.3-1ubuntu5) ...
Setting up libstdc++6-4.6-dev (4.6.3-1ubuntu5) ...
Processing triggers for install-info ...
Processing triggers for doc-base ...
Processing 3 changed doc-base files...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place



到目前为止,一切似乎都还不错,但是当我尝试编译c ++程序时,我收到了以下消息:



Everything seemed right until now, but when I tried to compile a c++ program, I got this message:

The program 'g++' can be found in the following packages:
 * g++
 * pentium-builder
Try: sudo apt-get install <selected package>



在安装过程中我忽略了哪些方面?请帮帮我.
在此先谢谢您.



What aspects have I overlooked in the installation process? Please help me out.
Thanks in advance.

推荐答案

请参阅我对问题的评论和Albert的评论.

基本上,您需要安装的是GCC以及C ++开发所需的全部:
Please see my comment to the question and a comment by Albert.

Basically, what you need to install is GCC and all you need to C++ development:
sudo apt-get install build-essential checkinstall


请参阅:
> https://launchpad.net/ubuntu/precise/amd64/build-essential [ ^ ].

如果问题是软件包的脱机安装,请参阅以下概述:
https://help.ubuntu.com/10.04/add-applications/C/offline.html [ ^ ].

您仍然可以下载软件以使其成为安装源.如果您尝试将软件下载到可以更好地访问Internet的地方,然后将其带到其他地方(例如家庭)安装,请考虑使用APTonCD.请参阅:
http://aptoncd.sourceforge.net/ [ ^ ].

—SA


Please see:
https://launchpad.net/ubuntu/precise/amd64/build-essential[^].

If the problem is the off-line installation of the package, please see this overview:
https://help.ubuntu.com/10.04/add-applications/C/offline.html[^].

You can download software to make it an installation source anyway. If you are trying to download the software somewhere where you can get better Internet access and then bring it and install somewhere else (say, home), consider using APTonCD. Please see:
http://aptoncd.sourceforge.net/[^].

—SA


您没有安装软件包g ++,而是安装了g ++-4.6.您可以通过命令g++-4.6启动编译器.
You didn''t install the package g++, you installed g++-4.6. You can start the compiler by the command g++-4.6.


这篇关于在ubuntu中安装c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆