I am learning C and wish to write the program using a text editor on my Mac (running OS X v10.7 (Lion)).
I write the .c
file, and compile it using gcc filename.c
- which creates executable file called a.out
. However, when I type a.out
or /a.out
, I get the following messages:
-bash: a.out: command not found
or
-bash: /a.out:
No such file or directory
I have successfully compiled and ran C programs on Linux systems before using this same method. What am I doing wrong on my Mac?