Terminal will not use updated a.out, how do I fix that?
You are typing in
~/a.out
Which means "run the a.out
program from the home directory." I think you want to type
./a.out
Which means "run the a.out
program from the current directory." If you are using gcc
, the newly-created program will be placed into the current directory (which, unless you're in the home directory, is not the same place), so the new version will run the right program.
Hope this helps!
gcc main.c~/a.out
The first line will compile to a.out in your current directory, while the second line executes a.out from your HOME directory. Are you in your home directory?
If not, change the second line to
./a.out
.
means current directory. So ./a.out
means execute the a.out
file in my current directory.