I'm trying to compile my c file created by MacVim with gcc on Mac terminal, but the screen showed like this:
r_yeh_mbp_2019@Robinsons-MacBook-Pro ~ % cd Desktop
r_yeh_mbp_2019@Robinsons-MacBook-Pro Desktop % cd Code
r_yeh_mbp_2019@Robinsons-MacBook-Pro Code % gcc TheMatingAlgorithm.c
error: error reading 'TheMatingAlgorithm.c'
1 error generated.
r_yeh_mbp_2019@Robinsons-MacBook-Pro Code %
However, it could be compiled if the file was created by command "vi" on terminal instead of using any other IDE to create(I also tried Atom to create):
r_yeh_mbp_2019@Robinsons-MacBook-Pro Code % gcc SearchAlgorithm.c -o sa.o
r_yeh_mbp_2019@Robinsons-MacBook-Pro Code % ./sa.o
Also, when I tried to use command "vi" to edit a c file created not by "vi", the terminal created a new file and showed like this:
"TheMatingAlgorithm.c" [Permission Denied]
Any help or comment is greatly appreciated. I've spent half day trying to find a solution by using English keyword and couldn't solve it.