Nico Battelli
Nico Battelli

Reputation: 71

stdio.h: No such file or directory

I got the foll. error compiling a simple ciao.c program

 In file included from ciao.c:1:
/usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
 #include <stdio.h>
          ^~~~~~~~~~
compilation terminated.

I've already installed Xcode, command line tools and what you want, but nope.

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

Could you help me please?

Upvotes: 2

Views: 3646

Answers (2)

Chener Zhang
Chener Zhang

Reputation: 129

I actually have the same issue that you have;here is the step, follow it, it may help you

choose 1: Copy and paste the following every time you open the terminal

export CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

choose 2: If the choose 1 is working then:

Step-1: Paste the following code in terminal:

open /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

Step-2: Open a new terminal, paste the following code:

open /usr/local/lib/gcc/x86_64-apple-darwin18.5.0/8.3.0/include-fixed/

Step-3: copy All file file from step-1, the direction(include) you have open -> paste in the step-2, the direction(include-fixed) you open

Step 4: When it asks you about whether to REPLACE the file or not, choose to replace.

Upvotes: 3

John
John

Reputation: 1032

Rename <_stdio.h> to <stdio.h>.

P.S. Here is an updated answer to the updated question:

Try reinstalling Xcode using xcode-select --install.

Upvotes: 3

Related Questions