how to instal g++ compiler and C++ in ubuntu??
can any one help me to install g++ compiler and C++ in the ubuntu ??
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Cesare Tirabassi
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Two quick ways :
. from command line, just sudo apt-get update && sudo apt-get install g++
(g++ is the GNU C++ compiler)
. from the menu bar / system / Package Manager (synaptic), search 'C++' in Development. Find 'g++' and select to install it
When you wander what the name of the package that could fits you need, use (command line) : apt-cache search KEYWORD (where 'KEYWORD' best define what your are looking for). Of course, you can use pipes and grep to better define what you're looking for.
hope this'll help you.
Revision history for this message
|
#2 |
when i tried by command line as u said :
something like this happened and the nothing then nothing happened
Get:1 http://
Ign http://
Ign http://
Get:2 http://
Ign http://
Get:3 http://
Ign http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:4 http://
And when i tried by system packege manager something like this happened
W: Duplicate sources.list entry http://
W: Duplicate sources.list entry http://
W: Duplicate sources.list entry http://
what should i do ???:
Revision history for this message
|
#3 |
Actually the problem is it is not connecting to the net???
and giveing following error
W: Failed to fetch http://
407 Proxy Authentication Required
Revision history for this message
|
#4 |
Hello Amit..
Could u please post to me all results given by the command:.
#] apt-get update
Remember to use "sudo" (or other root privileges)
Ps:. sorry about my bad english..iv'ed learned that by myself... lol...
Paz:.
Revision history for this message
|
#5 |
thanks budddy your English is as good as anyone else this are the results which i got ::
amit@amit:~$ sudo apt-get update
password:
Get:1 http://
Ign http://
Ign http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:2 http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:3 http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:4 http://
Hit http://
Get:5 http://
Ign http://
Ign http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Get:6 http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Get:7 http://
99% [7 Sources bzip2 0] [Connecting to netmon.iitb.ac.in (10.200.13.50)] 29.9kB/s 0s
bzip2: Data integrity error when decompressing.
Input file = (stdin), output file = (stdout)
It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
Err http://
Sub-process bzip2 returned an error code (2)
Hit http://
Hit http://
Hit http://
Hit http://
Get:8 http://
Hit http://
Hit http://
Get:9 http://
Hit http://
Get:10 http://
Hit http://
Fetched 229kB in 21s (10.8kB/s)
Failed to fetch http://
Reading package lists... Done
Revision history for this message
|
#6 |
thanks to all my friends
now i have got g++ installed......but still there is a problem coming that is when i am running a c++ code it is giving the error like this
can u sort out what is the problem there (as i think that C++ lib files are not there )
amit@amit:~$ g++ p.c -o simple
In file included from /usr/lib/
/usr/lib/
amit@amit:~$
Revision history for this message
|
#7 |
Amit,
if your original problem is solved please mark it so and open a new ticket.
Revision history for this message
|
#8 |
Thanks Cesare Tirabassi, that solved my question.
Revision history for this message
|
#9 |
Thanks,
but you should acknowledge the guy that helped you solve the problem.
Revision history for this message
|
#10 |
I think he can still use this ticket, cause his update in apt sources get some trouble using that mirror..
look:
bzip2: Data integrity error when decompressing.
Input file = (stdin), output file = (stdout)
It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
Let's give a "blind" shot...
try to purge the fles you have downloaded like this:.
#] aptitude purge package_name
Then, use this source list for download - just for test, make a backup before:
#] cp /etc/apt/
Then edit the sources.list, remove all sources and put theese insteed:
deb http://
deb-src http://
deb http://
deb-src http://
deb http://
deb-src http://
deb http://
deb-src http://
If youŕe using an old-stable ubuntu (edgy) just change the word FEISTY for edgy like the exemple below:
deb-src http://
After that, do some update:.
#] apt-get update
And try to install the packages GCC and C++ ...
Let me know if that help u out!
;-) See yah!
Revision history for this message
|
#11 |
thaks to all u buddies i am really happy now as my problem is solved.........
Revision history for this message
|
#12 |
hi all,
i had installed ubuntu recently..when i tried to install other softwares in during ./configure it gave an error like gcc folder not found..
whats the problem and how do i solve it..i am not having net connection so i cannot download..but i can download on my windows machine and run get it here..
please help me
Revision history for this message
|
#13 |
hi ,
Actually most of the software programs are written in c and to run those we need a compiler gcc, thats why the error is coming like gcc not found as it is not in your system.
Now you can do two things :
1) simplest way :
if you are able to connect with the internet then in the command line type :
sudo apt-get install gcc
it will ask you root passward type that and then everything is done just hit yes at every questions then.
2) or gc is also in the ubuntu installation CD you can find it at:
/pool/main/g/
and install all the packages of g there your problem will be solved
Revision history for this message
|
#14 |
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
sufal@sufal-
[sudo] password for sufal:
Get:1 http://
Ign http://
Get:2 http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:3 http://
Ign http://
Ign http://
Ign http://
Get:4 http://
Ign http://
Ign http://
Ign http://
Ign http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Get:10 http://
Get:11 http://
Get:12 http://
Get:13 http://
Get:14 http://
Get:15 http://
Get:16 http://
Get:17 http://
Get:18 http://
Get:19 http://
Get:20 http://
Get:21 http://
Get:22 http://
Get:23 http://
Get:24 http://
Get:25 http://
Get:26 http://
Get:27 http://
Get:28 http://
Get:29 http://
Get:30 http://
Fetched 11.0MB in 14min 12s (13.0kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
cpp-4.4 g++-4.4 gcc-4.4 gcc-4.4-base libgcc1 libgomp1 libstdc++6
libstdc+
Suggested packages:
gcc-4.4-locales g++-multilib g++-4.4-multilib gcc-4.4-doc libstdc++6-4.4-dbg
gcc-4.4-multilib libmudflap0-4.4-dev libgcc1-dbg libgomp1-dbg
libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7 libstdc++6-4.4-doc
The following NEW packages will be installed:
g++ g++-4.4 libstdc++6-4.4-dev
The following packages will be upgraded:
cpp-4.4 gcc-4.4 gcc-4.4-base libgcc1 libgomp1 libstdc++6
6 upgraded, 3 newly installed, 0 to remove and 273 not upgraded.
Need to get 13.3MB of archives.
After this operation, 20.8MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Fetched 13.3MB in 20min 59s (10.5kB/s)
(Reading database ... 114040 files and directories currently installed.)
Preparing to replace gcc-4.4-base 4.4.1-4ubuntu8 (using .../gcc-
Unpacking replacement gcc-4.4-base ...
Setting up gcc-4.4-base (4.4.1-4ubuntu9) ...
(Reading database ... 114040 files and directories currently installed.)
Preparing to replace libstdc++6 4.4.1-4ubuntu8 (using .../libstdc+
Unpacking replacement libstdc++6 ...
Setting up libstdc++6 (4.4.1-4ubuntu9) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
(Reading database ... 114040 files and directories currently installed.)
Preparing to replace libgomp1 4.4.1-4ubuntu8 (using .../libgomp1_
Unpacking replacement libgomp1 ...
Preparing to replace cpp-4.4 4.4.1-4ubuntu8 (using .../cpp-
Unpacking replacement cpp-4.4 ...
Preparing to replace gcc-4.4 4.4.1-4ubuntu8 (using .../gcc-
Unpacking replacement gcc-4.4 ...
Preparing to replace libgcc1 1:4.4.1-4ubuntu8 (using .../libgcc1_
Unpacking replacement libgcc1 ...
Processing triggers for man-db ...
Setting up libgcc1 (1:4.4.1-4ubuntu9) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Selecting previously deselected package libstdc++6-4.4-dev.
(Reading database ... 114040 files and directories currently installed.)
Unpacking libstdc++6-4.4-dev (from .../libstdc+
Selecting previously deselected package g++-4.4.
Unpacking g++-4.4 (from .../g++
Selecting previously deselected package g++.
Unpacking g++ (from .../g++
Processing triggers for man-db ...
Setting up libgomp1 (4.4.1-4ubuntu9) ...
Setting up cpp-4.4 (4.4.1-4ubuntu9) ...
Setting up gcc-4.4 (4.4.1-4ubuntu9) ...
Setting up libstdc++6-4.4-dev (4.4.1-4ubuntu9) ...
Setting up g++-4.4 (4.4.1-4ubuntu9) ...
Setting up g++ (4:4.4.1-1ubuntu2) ...
update-
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
sufal@sufal-
sufal@sufal-