LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running C code in Redhat 7.2 (https://www.linuxquestions.org/questions/linux-newbie-8/running-c-code-in-redhat-7-2-a-49775/)

Sifu-Rusty 03-14-2003 04:37 AM

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.

mhearn 03-14-2003 05:26 AM

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

Sifu-Rusty 03-14-2003 05:52 AM

Thanks mhearn. That did the trick.


All times are GMT -5. The time now is 04:35 PM.