LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 03-14-2003, 04:37 AM   #1
Sifu-Rusty
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Rep: Reputation: 0
Running C code in Redhat 7.2


Hi,
I'm new to this forum and a unix newbee. You'll probably see lots of posts from me comming up for the next few months.

I had to install unix because I'm doing C programming for unix.
I started with something simple, a hello world C program, which I saved as hello.c

I then compiled as
gcc hello.c -o hello

This makes an executable binary file in the same dir.
But how do I run it? If I just type 'hello' and press enter it says 'command not found'. I also tried running it through the GNOME interface but nothing happens.

I'm using Redhat 7.2 with GNOME.
 
Old 03-14-2003, 05:26 AM   #2
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 57
For security reasons the current directory is not normally in your PATH on most Linux setups. To run a program in the current directory, do this:

./hello
 
Old 03-14-2003, 05:52 AM   #3
Sifu-Rusty
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks mhearn. That did the trick.
 
  


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
running executable in C++ code psIpher Programming 2 11-25-2005 01:44 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
what is the file location of Redhat source code?? nazib Linux - General 1 02-26-2005 03:18 AM
porting a C++ code to redhat Linux environment KevinG Programming 12 01-02-2004 03:55 PM
how to compile redhat 9.0 source code. wood Linux - General 5 09-16-2003 10:05 AM

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

All times are GMT -5. The time now is 07:54 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