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

compile and run c program in linux

Just getting started.

I wrote the basic hello.c and ran cc -g -ohello hello.c

I got an executable hello (based on ls -F) and when I type hello I get a "command not found" error.

What's up!
0
spstrong
Asked:
spstrong
  • 2
1 Solution
 
JBURGHARDTCommented:
type ./hello
0
 
spstrongAuthor Commented:
Why?

What is the deal?

If I write a REAL application how do I get it set up for the user to just type the application name?
0
 
spstrongAuthor Commented:
For those of you who come here looking for the answer to the question, Linux (and I suppose UNIX in all its flavors) doesn't see the current directory as automatically part of the path.  To add it to the path:

$>PATH=&PATH:./

will add it to the path.

type set  |more to see if it took.

bbfn
stephen p.
0

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