PDA

View Full Version : Gcc Compiles Correctly But No Output



tcooper4
November 2nd, 2007, 03:17 AM
I have a very simple c program:

#include <stdio.h>
void main(void)
{
printf("sweet it worked");
}

I then compile it:

$ gcc test.c -o test
$ test
and I get nothing out any ideas?

lucia_engel
November 2nd, 2007, 03:25 AM
Try this:

./test

It worked for me.

LaRoza
November 2nd, 2007, 04:12 AM
I then compile it:

$ gcc test.c -o test
$ test
and I get nothing out any ideas?

You have to add "./" before running it. You cwd is not usually in your PATH, and it shouldn't be. "." means your current directory.