I'm trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I'm getting the following error at compile time:
gcc: fatal error: stdio.h: No such file or directory
I then tried a simple Hello World program:
#include <stdio.h> int main(int argc, const char *argv[]) { printf("Hello, world!"); return 0; }
Again, upon running gcc -o ~/hello ~/hello.c
, I got the same error. I'm using an experimental version of gcc
, but it seems implausible that there would be a release which generated errors upon importing stdio
. What could be causing this issue, and how can it be fixed?
How do I fix GCC fatal error no input files? Make sure that you are running gcc s1. c while you are in program directory or you can try gcc program/s1. c if you are not in program directory.
If we use #include<stdio. h> in your c program, it will include stdio. h file into our source program which has the information for all input, output related functions.
The File Stdio. h is included in the path C:\Program Files (x86)\Windows Kits\10\Include\10.0. 17134.0\ucrt.
p.s. the standard location on *nix systems would be /usr/include/stdio. h, i.e., #include looks in /usr/include and other -I directories passed as arguments to the compiler. Save this answer. Show activity on this post.
I had this problem too (encountered through Macports compilers). Previous versions of Xcode would let you install command line tools through xcode/Preferences, but xcode5 doesn't give a command line tools option in the GUI, that so I assumed it was automatically included now. Try running this command:
xcode-select --install
If you see an error message that developer tools are already installed (and still header files can't be found), wipe out any existing one to do a fresh installation:
sudo rm -rf /Library/Developer/CommandLineTools
(as per this answer)
sudo apt-get install libc6-dev
(as per this comment)
apk add libc-dev
The accepted answer no longer works. When running the command xcode-select --install
it tells you to use "Software Update" to install updates.
In this link is the updated method:
Open a Terminal and then:
cd /Library/Developer/CommandLineTools/Packages/ open macOS_SDK_headers_for_macOS_10.14.pkg
This will open an installation Wizard.
After updating to Mojave 10.15.1 it seems that using xcode-select --install
works as intended.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With