LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 08-23-2008, 09:22 AM   #1
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Rep: Reputation: 22
gcc compilation problem


when i tried to compile this program using gcc in kubuntu 8.04 I got this error message..........Plz help.

PROGRAM


#include<sys/types.h>
#include<fcntl.h>
#include<sys/stat.h>
int main(int argc,char *argv[])
{
int fdold,fdnew,count;
char buffer[100];
fdold=open(argv[1],O-RDONLY);
fdnew=creat(argv[2],0777);
do{
count=read(fdold,buffer,1);
write(fdnew,buffer,1);
}
while(count!=0);
}

ERROR


copy.c:1:22: error: sys/types.h: No such file or directory
copy.c:2:18: error: fcntl.h: No such file or directory
copy.c:3:21: error: sys/stat.h: No such file or directory
copy.c: In function ‚main‚:
copy.c:8: error: ‚O‚ undeclared (first use in this function)
copy.c:8: error: (Each undeclared identifier is reported only once
copy.c:8: error: for each function it appears in.)
copy.c:8: error: ‚RDONLY‚ undeclared (first use in this function)
 
Old 08-23-2008, 11:08 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
Quote:
copy.c:1:22: error: sys/types.h: No such file or directory
copy.c:2:18: error: fcntl.h: No such file or directory
copy.c:3:21: error: sys/stat.h: No such file or directory
Very simple, you have no 'glibc-devel'
'apt-get libc6-dev' will do.

Good Luck.

Last edited by knudfl; 08-23-2008 at 11:10 AM.
 
Old 08-23-2008, 12:12 PM   #3
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
I recommend installing the build-essentials package which will give you a lot of the developing tools needed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Help in program compilation using GCC East Linux - Newbie 2 02-15-2008 03:11 AM
have gcc compilation error during gcc installtion in linuxfromscratch vbshanmugaprakash Linux - General 3 12-13-2006 05:52 AM
gpm compilation on gcc 4.x... marekjs Slackware 3 06-27-2006 04:33 AM
Mplayer compilation problem on linux 2.6.3 gcc 3.3.3 glibc 2.3.2 realloc Linux - Software 4 10-22-2004 03:44 PM
GCC 3.4.0 Compilation Crashes derryp Linux From Scratch 3 06-11-2004 04:22 PM


All times are GMT -5. The time now is 01:08 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration