• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

c programming in linux

Hello,
  I am a newcomer to linux and just installed RedHat 7.0 in my PC. I wrote a very simple C program such as printing Hello World on the screen and complied the source code by typing
   gcc -o hello hello.c
The compling is Ok and a file called hello was generated.
But when i type hello to excute, it gave me such message:
bash: command hello not found.

I am really not familia with linux. Is anything wrong with the system? Or do i have to change any system file(such as .cshrc in Unix)?

Thank you.
0
huer
Asked:
huer
  • 2
1 Solution
 
interiotCommented:
Try ./hello

Shells won't automatically search the local directory unless "." is part of your path, in which case you have to prepend things with "./".
0
 
interiotCommented:
You can try putting

    export PATH=.:$PATH

in your ~/.bashrc (since you appear to be running bash).
0
 
huerAuthor Commented:
Thank you very much interiot.
I wish i can get more helps from you later on.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now