Skip to main content

[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:

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

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:

gcc this.c

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!

Comments

Post a Comment

Popular posts from this blog

Connect and Configure MongoDB in Django Project

  Django, a high-level Python web framework, is well-known for its robustness and versatility. While Django natively supports popular databases like PostgreSQL and MySQL, you may want to integrate a NoSQL database like MongoDB for specific use cases. MongoDB’s flexibility and scalability make it an excellent choice for handling unstructured data. In this blog, we will walk you through the process of connecting MongoDB to a Django project, enabling you to harness the power of NoSQL in your web applications. Prerequisites: Before we begin, ensure you have the following prerequisites in place: Django installed on your system. MongoDB database server installed and running. Basic familiarity with Django project structure and database concepts. Virtual Environment, this is optional but recommended. You check our blog  here . Note:  For this tutorial, we are using our basic  skeleton project  for Django. You can also download the project from  here . Step 1: Insta...

Mongodb-CheatSheet

  All MongoDb commands you will ever need (MongoDb Cheatsheet) In this post, we will see a comprehensive list of all the    MongoDB  commands you will ever need as a MongoDB beginner. This list covers almost all the most used commands in MongoDB. I will assume that you are working inside a collection named 'comments' on a MongoDB    database  of your choice 1. Database Commands View all databases show dbs Copy Create a new or switch databases  use dbName Copy View current Database db Copy Delete Database  db . dropDatabase ( ) Copy 2. Collection Commands Show Collections show collections Copy Create a collection named 'comments' db . createCollection ( 'comments' ) Copy Drop a collection named 'comments' db . comments . drop ( ) Copy 3. Row(Document) Commands Show all Rows in a Collection  db . comments . find ( ) Copy Show all Rows in a Collection (Prettified) db . comments . find ( ) . pretty ( ) Copy Find the first row matching the ob...

How to host Django Application in AWS using gunicorn & nginx in Production

in this post, we will see how to use    nginx  with    gunicorn  to serve    django     applications  in production.  Django is a very powerful web framework and ships with a server which is able to facilitate development. This development server is not scalable and is not suited for production. Hence we need to configure gunicorn to get better scalability and nginx can be used as a reverse proxy and as a web server to serve static files. Let's get started  Step 1 - Installing python and nginx Let's update the server's package index using the command below: sudo apt update Copy sudo apt install python3-pip python3-dev nginx Copy This will install python, pip and nginx server Step 2 - Creating a python virtual environment  sudo pip3 install virtualenv Copy This will install a virtual environment package in python. Let's create a project directory to host our Django application and create a virtual environment inside th...