LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 11-11-2005, 05:56 PM   #1
mparsons
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Rep: Reputation: 0
Compiling C in Fedora Core 2


I have a very simple program that I am trying to compile for a class project. I'm using fedora core 2 and gcc as the compiler. I am using gedit to create the file. Here is the program.

/* This is sample.c program */
/* your name*/
#include <stdio.h>

int main()
{
int hours=40;
int rate=20;
int pay=0;
pay = hours * rate;
printf (�\nHere is the pay amount: %d� , pay);

return (0);
}

When i try to compile the program it returns several errors. Just curious what I am doing wrong. Any help is appreciated.
 
Old 11-11-2005, 06:00 PM   #2
mparsons
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Original Poster
Rep: Reputation: 0
This line did not copy correctly here is what is was supposed to say:
printf ("\nHere is the pay amount: %d" , pay);
 
Old 11-11-2005, 06:39 PM   #3
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
It compiles fine here. What command did you use to compile it and what were the errors?
 
Old 11-12-2005, 04:00 AM   #4
mparsons
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Original Poster
Rep: Reputation: 0
i used gcc sample.c to compile the program it complains that it can't find stdio.h
 
Old 11-12-2005, 05:42 AM   #5
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
/usr/include/stdio.h should be available on your system. Perhaps you need to install some sort of glibc-devel.rpm?
 
Old 11-12-2005, 01:25 PM   #6
mparsons
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Original Poster
Rep: Reputation: 0
stdio.h is not in the /usr/include directory. Can I add it by going to add/remove programs? If so which program do I need to add?
 
Old 11-12-2005, 04:08 PM   #7
apepost
Member
 
Registered: Oct 2003
Distribution: Fedora core 4
Posts: 113

Rep: Reputation: 15
type "yum install glibc-devel" (as root). And the header files you need will hopefully be installed.
 
Old 11-14-2005, 12:16 AM   #8
mparsons
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you so much apepost. You are a lifesaver. I have been pulling my hair out trying to get this to work
 
  


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
Compiling a driver for Fedora core 2?? teodavinci Linux - Hardware 1 12-15-2005 10:34 AM
Compiling C programs in Fedora Core 2 dreamydinesh Linux - Software 4 10-03-2005 02:51 AM
Compiling Fedora Core Kernel betamike Fedora 2 03-04-2005 07:47 AM
Compiling 2.6.6 kernel in fedora core 2... SpItoS Linux - Newbie 4 01-17-2005 03:51 PM
Compiling superkaramba on Fedora Core 3? JimDog Linux - Software 2 11-14-2004 04:16 AM


All times are GMT -5. The time now is 07:53 AM.

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