Search code examples
cgcc

gcc errors “No such file or directory”


Trying to compile a source code written in C. Location of the code is: C:\Users\Chris\Documents\prog\c\learn\GOODBYE.C

In CMD I typed the code: gcc goodbye.c -o goodbye

Got this error:

gcc: error: goodbye.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.

I wanted the output to be named goodbye.

How do I fix this?


Solution

  • Make sure that you are running gcc goodbye.c -o goodbye while you are in the C:\Users\Chris\Documents\prog\c\learn\ directory.

    If the c file is named GOODBYE.c then you should run gcc GOODBYE.c -o goodbye