This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Compiled Program has no output


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]