LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 06-04-2008, 12:14 AM   #1
shady_Dev
Member
 
Registered: Jun 2007
Posts: 44
Blog Entries: 1

Rep: Reputation: 15
apt not working


Hi,
I ve installed Kubuntu 8.0 on my system.I want to do some programming on my system in C.But the gcc is not working properly.For the following program:
h.c
****
#include <stdio.h>

int main()
{
printf("HelloWorld");
}

I get the output::
h.c:2:19: error: stdio.h: No such file or directory
h.c: In function âmainâ:
h.c:6: warning: incompatible implicit declaration of built-in function âprintfâ

My apt is also not working when i do "sudo apt-get install glibc" for any package it gives the following error::


Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package glibc


What should i do:;:here is my "etc/apt/sources.list" file :->

# deb cdrom:[Kubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://in.archive.ubuntu.com/ubuntu/ hardy main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://in.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy universe
deb http://in.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://in.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://in.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
## offered by Canonical and the respective vendors as a service to Ubuntu
## users.
# deb http://archive.canonical.com/ubuntu hardy partner
# deb-src http://archive.canonical.com/ubuntu hardy partner

deb http://security.ubuntu.com/ubuntu hardy-security main restricted
deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted
deb http://security.ubuntu.com/ubuntu hardy-security universe
deb-src http://security.ubuntu.com/ubuntu hardy-security universe
deb http://security.ubuntu.com/ubuntu hardy-security multiverse
deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse



Please tell me what to do......

Thanks in advance!!!
 
Old 06-04-2008, 02:50 AM   #2
htnakirs
Member
 
Registered: Mar 2007
Posts: 239

Rep: Reputation: 34
Probably the package has a different name. Does running apt bring the GUI? If yes, search for "C", this will bring a list of packages from which the relevant one can be picked.

OT : Some distros like Mandriva, Opensuse, PC Linux have the GUI for app management, and that is comparatively an easier way to manage installation.
 
Old 06-04-2008, 04:34 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
'sudo apt-get install build-essential' or use synaptic.
This will install the needed devel tools, included 'libc6-dev'
which is the name for glibc on Debian based distros, e.g. Ubuntu.

Rgds
PS.: headers (file.h) are usually in "package-name"-dev

Last edited by knudfl; 06-04-2008 at 05:58 AM.
 
Old 06-04-2008, 07:05 AM   #4
shady_Dev
Member
 
Registered: Jun 2007
Posts: 44

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Thanks for reply!!!
I tried sudo apt-get install build-essential but it doesnt work ..the error message was..

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package build-essential

I dont have synaptic package manager on my system
what should i do know...???
 
Old 06-04-2008, 08:23 AM   #5
farzadfedora
Member
 
Registered: Jul 2007
Distribution: kubuntu
Posts: 80

Rep: Reputation: 15
hi...
Quote:
I ve installed Kubuntu 8.0 on my system.I want to do some programming on my system in C.But the gcc is not working properly.For the following program:
My friend...
It's better to use "g++" or "c++" compiler...
because it's more better than gcc and supports many librarys and C Language ...
I tested your program with g++ and had no problems while compiling and run...
Quote:
My apt is also not working when i do "sudo apt-get install glibc" for any package it gives the following error::


Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package glibc


What should i do:;:here is my "etc/apt/sources.list" file :->
first run adept-manager:

KMenu -> System -> Adept Manager

now in adept-manager window in "Adept" menu Press the "Fetch Updates" key and wait for it to download headers...
now you can use your command for installing packages... (like "sudo apt-get install libc6"

I Hope It Be Helpful...
Bye.
 
Old 06-06-2008, 12:05 AM   #6
shady_Dev
Member
 
Registered: Jun 2007
Posts: 44

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Sir,
I intend to say that i ve nt got standard c library in my system i think there is no problem with gcc.Secondly, i did what you said {fetch updates}.But it has no effect, it gives the following output


sudo apt-get install libc6
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.




i have got some problem with my Adept package manager which i m not able to resolve.Please help me at this point.Because my Adept doesnt work for any package. I already mentioned the output it gives ,in the former post when i try to install something.
 
Old 06-06-2008, 08:55 AM   #7
farzadfedora
Member
 
Registered: Jul 2007
Distribution: kubuntu
Posts: 80

Rep: Reputation: 15
Lightbulb Your Answer My Friend...

Hi...

Quote:
I ve installed Kubuntu 8.0 on my system.I want to do some programming on my system in C.But the gcc is not working properly
i tested your program a lot with gcc...
and when i removed the << printf("HelloWorld"); >> line your program compiled successfuly .
i know printf function is in the stdio.h header but i dont know why it dont have this useful I/O function !!!!
but g++ have it...
you can use it as a good compiler...
it can compile standard C programs too...
but if you dont want to use it you have only one more way...
you have to download the newest gcc package and install it again...
you can search and download it as DEB binary file in this website easily...

http://packages.ubuntu.com

Quote:
i did what you said {fetch updates}.But it has no effect, it gives the following output
my friend ...
libc was an example ...
you have to replace it with the name of the package that you want ...
and for this result
Quote:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
it's because you have the newest version of libc (The Example package)

ok...
now test this code for glibc (something you want)
Code:
sudo apt-get install glibc

if you want to solve your adept-manager problem first boot in recovery mode (select it from grub)
then wait for some seconds ...
OK...
Now Recovery mode is Ready...
first you have to be as root user...
for do this enter this command and then enter your password...
Code:
sudo su
now enter this command and accept everything that will asks you

Code:
apt-get install -f
and now this command:

Code:
apt-get autoremove
by this commands you will remove packages are not installed correctly...

ok...
it's done
now you can restart your system by this command and boot your system in normal type.
Code:
reboot
OK... Your Adept Manager repaired.

I Hope It Be Helpful

Bye.

Last edited by farzadfedora; 06-06-2008 at 08:57 AM.
 
Old 06-07-2008, 02:11 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
To compile programs you need development versions.
Try 'sudo apt-get update' (will add more packages using
"address list" /etc/apt/sources.list to your list of
install candidates)
And then 'sudo apt-get install libc6-dev'

And try again 'sudo apt-get install build-essential'
and if no result do
'sudo apt-get install g++-4.2'
(which also will get you libstdc++6)

Then you at least have some of the tools.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apt-get not working johngrinham Linux - General 11 04-18-2006 07:48 AM
apt-get install not working / apt-get update is ok remy215 Debian 2 10-01-2005 07:02 PM
apt-get not working tgkspike Linux - Software 0 04-26-2004 11:14 PM
apt-get not working in Knoppix 3.2 quo_vadis Debian 1 10-04-2003 09:10 PM
apt-get isn't working don1 Linux - Software 1 02-15-2003 07:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration