Compiled Program has no output

Larry temp@cogeco.ca
Mon Nov 3 02:09:00 GMT 2003


 
Hi Claudio!

You hit it dead on!  Thank you very much for your help.

I tried './test' and my "test" program worked like a charm.

Thanks,

Laurence

-----Original Message-----
From: Claudio Bley [mailto:bley@wh2-19.st.uni-magdeburg.de] On Behalf Of
Claudio Bley
Sent: Sunday, November 02, 2003 8:35 PM
To: Larry
Cc: gcc-help@gcc.gnu.org
Subject: Re: Compiled Program has no output

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