PDA

View Full Version : NOOB - GCC run after compiling



mysttt
May 23rd, 2007, 08:58 PM
after installing gcc, issues occur:

gcc -o morning morning.c ---> no pro about compile, morning file exists then

but when I run
morning --->it says: bash: morning: command not found
which was supposed to be a "Good Morning" printed on the screen


this "morning.c" rather simple

#include <stdio.h>

int main(int argc, char** argv) {

printf("Good Morning\n");

return 0;

}


So, could u guys help me, what's the problem here? I am totally new in Linux.. Thanks!

WW
May 23rd, 2007, 09:06 PM
Put ./ in front of the command:


$ ./morning


By default, the bash search path (in the evironment variable PATH) does not include the current directory. Putting ./ in front of the command tells the shell to look for the command in the current directory. (A dot means the current directory.)

mysttt
May 24th, 2007, 05:30 PM
Thanks!