Saturday, January 11, 2014

Clang can't find stdio.h, etc

I decided to play with Clang on Windows this morning, using the pre-compiled binaries. However, when I try to compile a hello world app, I get this error message:

fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.


Googling didn't help me figure out where to get the standard library for c. But, when I did clang --verbose hello.c, I got a hint:

...
ignoring nonexistent directory "c:/mingw/include"

...

So, I installed MinGW (and its mingw32-base and mingw32-gcc-g++ packages).  Now, I have that directory, and have a standard library for C that Clang can use, along with a ton of useful utilities.  I then added the C:\MinGW\bin directory to my path.




4 comments:

  1. Thank you, this post helped me! :)

    ReplyDelete
  2. This solved my three hour problem.

    ReplyDelete
  3. Thank you very much! I had googled the world but no help. You save me!

    ReplyDelete