Compiled Program has no output

Claudio Bley bley@cs.uni-magdeburg.de
Mon Nov 3 01:37:00 GMT 2003


On Sun, Nov 02, 2003 at 07:59:04PM -0500, Larry wrote:
> Hi All!

Hi.
 
> I am not too familiar with the nuances of gcc and would appreciate any help
> any of you can extend with my problem described below.
> 
> I have coded up the following program named test.c:
> 
> seawolf:~/test% gcc -Wall -c -o test.o test.c
> seawolf:~/test% gcc -Wall -o test test.o 
> 
> I then executed the test program:
> seawolf:~/test% test
> seawolf:~/test% 

This is a common error. Don't name your test program `test'. This
"error" happens because you're not running your program. I know, you
thought you was, but you were wrong. ;-)

As it seems you've got your current working directory added to your
PATH. (This may be a bad idea under certain circumstances, btw.)

Depending on the location of your CWD in the PATH variable the shell
decides which program to run. If you're using bash, there is also a
shell builtin called `test' which takes precedence over other
executables. 

To see which program gets executed use the `type' builtin (bash) or
the which command.

$ type test
test is a shell builtin
$ which test
/usr/bin/test

Try specifiying a relational or absolute path in order to run your 
program; e.g.:

$ ./test

HTH
-- 
Claudio Bley                                 ASCII ribbon campaign (")
Debian GNU/Linux user                         - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \



More information about the Gcc-help mailing list