Usama Abdul
Usama Abdul

Reputation: 21

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?

Upvotes: 0

Views: 39506

Answers (4)

Tianna DeSouza
Tianna DeSouza

Reputation: 1

I ran into a similar issue, I used:

gcc -o goodbye goodbye.o -no-pie

Upvotes: 0

Sagnik Ghosh
Sagnik Ghosh

Reputation: 67

Enter the name of the directory in which the program is located. Like if the program is in "D" drive, then open the VS Code terminal and enter "D:" (without quotation) and hit enter, and then rerun the code like this.

Upvotes: 1

Zachary McGee
Zachary McGee

Reputation: 504

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

Upvotes: 5

Alex
Alex

Reputation: 163

what if you run gcc "C:\Users\Chris\Documents\prog\c\learn\GOODBYE.C" -o goodbye

I guess it could be the case sensitivity. Either rename the file or run gcc GOODBYE.C -o goodbye

Upvotes: 0

Related Questions