Compiled Program has no output

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


Hi All!

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:

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
  fprintf(stderr, "testing 123\n");
  exit(0);
}

I tried compiling it using the following commands:

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% 

I did not get any output.

However, when I tried compiling with the following commands:
seawolf:~/test% gcc -Wall test.c

I then exexecuted the test program:
seawolf:~/test% a.out
testing 123
seawolf:~/test%

Now, I get some output!  

Hmm... I don't understand what is going on since I thought the two methods
of compilation I outlined above should be equivalent.

Thanks,

Laurence



More information about the Gcc-help mailing list