user906357
user906357

Reputation: 4685

Compiling with gcc in macOS Mojave

Before updating to Mojave I was compiling C programs just fine. I used an older version of gcc, 7.3, that I installed using the instructions found here.

Then I updated to Mojave and tried compiling the simple program that follows with gcc main.c:

#include <stdio.h>
int main(){
    printf("Hello World\n");
    return 0;}

This results in the following error:

/usr/local/lib/gcc/x86_64-apple-darwin17.5.0/7.3.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
 #include <_stdio.h>
      ^~~~~~~~~~
compilation terminated.

If I remove the include it will compile with implicit declaration warnings for printf, but will still compile and run properly, printing Hello World. Does anyone know the issue and how I can fix it?

Upvotes: 2

Views: 1474

Answers (1)

user906357
user906357

Reputation: 4685

I figured out how to fix it. I went to

/Library/Developer/CommandLineTools/Packages/

then opened and installed macOS_SDK_headers_for_macOS_10.14.pkg.

Upvotes: 3

Related Questions