[cfe-dev] stddef.h missing

Chris Lattner clattner at apple.com
Sun Dec 16 22:46:05 PST 2007


On Dec 16, 2007, at 10:21 PM, Zhongxing Xu wrote:

> The following code fails compile.
>
> #include <stddef.h>
>
> void foo()
> {
>   int *p = NULL;
> }
>
> $ clang -fsyntax-only 1.c
> 1.c:1:10: error: 'stddef.h' file not found
> #include <stddef.h >
>          ^
> 1.c:5:12: error: use of undeclared identifier 'NULL'
>   int *p = NULL;
>            ^
> 2 diagnostics generated.
>
> clang should provide its own stddef.h as gcc does. Where should this  
> header go in the directory?

clang currently uses the GCC versions of these files.  I'd wager that  
'clang -v 1.c' does not list the gcc include directory.  To handle  
this, you have to hack the clang driver to know where to look  
currently.  Search for "FIXME: temporary hack: hard-coded paths" on  
this page:
http://clang.llvm.org/get_started.html

-Chris



More information about the cfe-dev mailing list