Skip to content

How to fix ‘Clang: Error: No input files’?

  • by
  • 2 min read

Programming has come a long way from its early Assembly days. Now we have a lot of different programming languages to choose from, each with its difficulties and pros and cons. 

However, that’s not to say you’ll get through writing code without hitting any snags. In this article, we’re talking about the “clang: error: no input files” issue that you might face with C++ and how to fix the problem.

Also read: How to fix ‘error performing request unknown error’?

Run the xcode installer

The first thing you should do is run the xcode-select installer. It’ll download and set up any file you might need to run clang. Run the following command in the terminal, and you’re good to go. 

xcode-select -- install

Check the file directory

Before you can run your script, your terminal needs to be in the same directory as your script itself. You can either navigate to the folder, right-click and open a terminal, or use the cd command to navigate the folder tree inside the terminal.

What is Metadata? Types and benefits | Candid.Technology
Photo by Shahadat Shemul

Regardless, once you’re in the same directory as the script, try running it, and it should work just fine, provided there were no other bugs in the code.

Point to xcode

Sometimes your computer might not know where Xcode is installed even after installing the package. In such cases, you can manually point to your Xcode installation using the following command.

sudo xcode-select --switch /Applications/

Specify the GCC version

Sometimes the compiler might be unable to find a file to compile using GCC. In such cases, you will have to specify the GCC version installed on your machine manually. To find the GCC version, run the following command in the terminal.

gcc -v

Also read: A fatal error occurred when running Fusee: 4 Fixes

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: