LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2012, 10:36 AM   #1
tchofo
LQ Newbie
 
Registered: Jun 2012
Distribution: ubuntu, windows 7 64
Posts: 11

Rep: Reputation: Disabled
Unhappy help with use the c compiler on redhat 6.1, been there for over 2 weeks now!!!!!!!!


hi guys, on windows i've used it's c compilers , but i just installed the redhat system on my cp , and i don't know how to use it's compiler, please could you help me , either with some commands ,or something else , to help me at least compile a "hello world" program.thanks
 
Old 06-28-2012, 10:50 AM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
hello.c:
Code:
#include <stdio.h>
int main(void)
{
    printf("Hello world!\n");
    return 0;
}
To compile and run hello.c:
Code:
$ gcc hello.c -W -Wall -O3 -o hello
$ ./hello
Hello world!
Linux and other operating systems do not require any specific file name suffix for programs. Any program you use must be in one of the directories listed in the PATH environment variable (just like in Windows), or you need to specify the exact path to it. When the program is in the current directory, current directory ./ is a suitable path. Any relative path, like ../hello if hello was in the parent directory, will work too.

At this point, your major problem is that Windows is all you have experience with. You expect computers and environments to behave in a certain way -- the Windows way --, and that is just not the case. Unless you can drop the "Windows-isms", your expectations due to your Windows experience, you will be very, very frustrated.

If you can convince yourself that just because Windows works in a specific way, there is no reason to expect other computers behave the same way, nor is there any reason to assume the Windows way is the best way, you will find Linux easy to learn and to get accustomed to. If not, well, I'd say you'd be happier sticking with Windows.
 
1 members found this post helpful.
Old 07-09-2012, 04:00 AM   #3
tchofo
LQ Newbie
 
Registered: Jun 2012
Distribution: ubuntu, windows 7 64
Posts: 11

Original Poster
Rep: Reputation: Disabled
thank you very much , it worked , i also used it on a centos 5.3 system , but i had so much problems , could someone know why? thanks
 
Old 07-09-2012, 04:14 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by tchofo View Post
but i had so much problems , could someone know why?
Not unless you tell us what your problems actually were.
 
Old 07-09-2012, 11:36 AM   #5
tchofo
LQ Newbie
 
Registered: Jun 2012
Distribution: ubuntu, windows 7 64
Posts: 11

Original Poster
Rep: Reputation: Disabled
thank you very much for the corrections , i tried and retried and finally it went through thank you very much for your help , i have had a first experience , let me try now to go further , if i find more problems i will ask, thank you very much for your help and stay blessed.
 
Old 07-10-2012, 02:48 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
even easier...

Code:
$ make hello 
cc -Wall    hello.c   -o hello
 
  


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
[SOLVED] RedHat runs for 1-2 weeks then dies at the GRUB prompt hbutz Linux - General 7 11-18-2011 06:49 AM
LyX-1.4.3 compiler error on redhat-7.3 dirgni Linux - Software 2 10-05-2006 12:23 PM
Redhat 9 GCC compiler HELP! (n00b here) Jaykay3k Linux - Software 5 02-21-2005 12:59 PM
GCC compiler issues redhat 7.3 geogeer Linux - Newbie 5 04-16-2004 11:09 PM
'C' compiler for redhat linux 9.... mahamkali Linux - Software 4 12-04-2003 11:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:05 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
Open Source Consulting | Domain Registration