Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Linux 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
 
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.
Posted 21-May-12 7:04am
Comments
Albert Holguin at 21-May-12 13:13pm
   
Wait... if you can download something from windows, why can't you download it from Linux? ...it's probably easier to install from the Ubuntu software centre than from anywhere else (or the package manager).
SAKryukov at 21-May-12 14:17pm
   
Absolutely right (by maybe OP downloaded it somewhere else and wanted to bring to another computer).
--SA
SAKryukov at 21-May-12 14:27pm
   
...so, I added some information relevant to this problem in my answer.
--SA
kr_harsha at 21-May-12 22:30pm
   
on windows, i use a download manager, so i get better download speeds than on ubuntu!
SAKryukov at 23-May-12 11:39am
   
Interesting. This might be another reason. Is it download for Ubuntu or something more general? Could you share the reference?
If this is special for Ubuntu (or Debian in general), why it's faster? Does it check up all dependencies, etc?
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You didn't install the package g++, you installed g++-4.6. You can start the compiler by the command g++-4.6.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 375
1 Prakriti Goyal 242
2 Yogesh Kumar Tyagi 224
3 Sergey Alexandrovich Kryukov 158
4 CPallini 150
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 22 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100