[Solved] gcc.exe error - No such file or directory gcc.exe: fatal error: no input files compilation terminated.
[Solved] gcc.exe error - No such file or directory gcc.exe: fatal error: no input files compilation terminated.
One of my friends asked me how to solve this error:
This error is pretty much saying that you have the gcc installed and working on your computer, but you don't have the file named this.c on this directory.
The presence of this error essentially means that you are in the wrong directory.
How to solve no such file or directory error in gcc
To get into the correct directory, all we need to do is use the cd command. Alternatively, you can navigate through windows explorer to get into the correct directory by following the steps below:
Step 1: Go to the location of the file you want to compile using gcc and press shift, and right-click at the same time.
You will now be offered a navigation menu like this:
Step 2: Click on the "Open PowerShell window here" option, and you will find the PowerShell window opened inside that directory
Step 3: Type gcc <filename.c>
Since my filename is this.c I will type:
Step 4: Type a.exe to execute your compiled program. Your program will compile and run, as shown below:
Conclusion
Hence we saw that "No such file or directory gcc.exe: fatal error: no input files compilation terminated." is not a problem with gcc or c installation but a problem with navigating into the correct directory.
I hope this post solved your issue. Let me know how the problem in your case occurred in the comments below!
Happy coding!
pls do somting
ReplyDelete