Results 1 to 4 of 4
Hello,
I've just tried both ubuntu and fedora in VMWare (virtual pc), I've managed to make this little program
Code:
#include <stdio.h>
int main()
{
printf("Hello\n");
return 0;
}
I ...
- 12-13-2007 #1Just Joined!
- Join Date
- Dec 2007
- Posts
- 2
c program doesn't output text in terminal
Hello,
I've just tried both ubuntu and fedora in VMWare (virtual pc), I've managed to make this little program
I compile and link it like thisCode:#include <stdio.h> int main() { printf("Hello\n"); return 0; }
gcc -o test test.c
But when I run it (by typing test) in the terminal, nothing is displayed, and I get no error message.
However If I run it in the gdb debugger, the text is displayed.
Since I've tried this both in Ubuntu and Fedora with the same results, I'm thinking there must be something about linux that I don't know
thanks for any help,
--
Sigurd Lerstad
- 12-14-2007 #2
There is already a real live program called "test".
Go to a directory which does not contain your test program and say this at the command line:
to see where that other program is. Then do this at the command line:Code:which test
to see the list of directories which bash will search for a program, and the order in which it searches them. I'm thinking that the directoryCode:echo $PATH
is near the end of that list.Code:.
Rename your program to something like test1 (at least in the compiled form; you can still name the source test.c if you like), and your problem should disappear.
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.
- 12-14-2007 #3Just Joined!
- Join Date
- Dec 2007
- Posts
- 2
- 12-15-2007 #4Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Hint: call your test programs "try".


Reply With Quote
