Topic: missing stdio.h in macOS

Hi there,

I am trying to compile c code that I was able to compile easily with the windows version and for some reason I can not get it compile it in macOS because the compiler can not find stdio.h. I have looked within the program for this header and can not find it.

I have tried to compile a simple hello world with the same result:

#include <stdio.h>

void main()
    printf("\nHello World\n");

Compiling hello_world.c
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
hello_world.c:1:10: fatal error: stdio.h: No such file or directory
    1 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.
Error: Last command making (build/hello_world.o) returned a bad status
Error: Make execution terminated

What am I doing wrong?
Thanks for your help.

Re: missing stdio.h in macOS

On macOS, we only provide the compiler for C and C++.  Both actually use the macOS headers and system libraries where possible.   

My guess is, for whatever reason, is that the "Command-Line Tools" need to be installed or reinstalled.  This procedure sounds worse than it actually is.  In macOS, open the Terminal app (it should be in the Applications folder under Utilities).  At the prompt, type:

xcode-select --install

That should cause a window to popup where you can simply select "Install."  That should fix the problem, though you might need to restart Simply Fortran first.

Let me know if this suggestion works!

Jeff Armstrong
Approximatrix, LLC