LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2017, 03:21 AM   #1
siddhar
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Rep: Reputation: Disabled
Unhappy execution of c program


im trying to execute 1st program hello world,but it is unable compile.its showing some fatal error.somebody help me please.
#include<stdio.h>
main()
{
printf("hello world");
return(0);
}

this is my program

this is the error im getting
gcc cprg.c -o hello
cprg.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.
 
Old 07-14-2017, 03:38 AM   #2
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 142Reputation: 142
Have you tried gcc -o hello hello.c? That's the usual order, but I tried it on my machine and your order does seem to work.

Make sure you have the file "/usr/include/stdio.h"

and it looks like you're missing a space in your include statement, it should be:

Code:
#include <stdio.h>
I copied and pasted your code into a file and got a completely different error. This is a known working standard hello.c program, copy and paste it into a new .c file and try it and report back:

use "gcc -o hello whateverfilenameyouuse.c"

Code:
#include <stdio.h>

int main (int argc, char * argv[]) {

	printf("Hello World!\n");
	return 0;
}
(BTW: This probably should be in the Programming forum)

Last edited by Laserbeak; 07-14-2017 at 03:41 AM.
 
1 members found this post helpful.
Old 07-14-2017, 03:45 AM   #3
siddhar
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Smile thank you

i was unable to install library function to compile cprogram,now i've installed necessary functions and compiled and run my program.
 
Old 07-14-2017, 03:49 AM   #4
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by siddhar View Post
i was unable to install library function to compile cprogram,now i've installed necessary functions and compiled and run my program.
OK, great.

Since you've solved your problem, you should change the title of your post to put "[SOLVED]" in front of it.
 
1 members found this post helpful.
Old 07-14-2017, 07:43 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,302
Blog Entries: 13

Rep: Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696Reputation: 3696
Quote:
Originally Posted by Laserbeak View Post
OK, great.

Since you've solved your problem, you should change the title of your post to put "[SOLVED]" in front of it.
Hi,

Just to clear up any possible confusion. One does not edit their thread title to do this. Instead you use the Thread Tools pulldown menu and mark your thread as Solved. The OP has this capability. And they have correctly done this.
 
2 members found this post helpful.
  


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:Stopping execution of a program allomeen Programming 4 03-10-2006 07:42 PM
paralell program execution vishamr2000 Programming 17 08-28-2005 10:15 AM
execution of one program inside of another microsoft/linux Programming 2 03-18-2005 11:24 AM
Key bindings program (custom pasting, program execution, etc.) jrdioko Linux - Software 2 02-05-2005 10:09 PM
program execution monitoring imp Linux - General 1 05-26-2002 10:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:40 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration