Clang not compile c programs?

I use clang to compile most of the time when programming in c. Suddenly he stopped working. Whenever I try to compile something, it gives me this result Suppose the file name is test.c

clang test.c 

In file included from test.c:1:
/usr/include/stdio.h:33:11: fatal error: 'stddef.h' file not found
# include <stddef.h>
          ^
1 error generated.

The source of test.c is:

#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{
  printf("\nthis is a sample c program\n");
  return EXIT_SUCCESS;
}

Note: on other compilers like gcc, it still works. What should I do to make clang work?

If you need system information: I am using 32-bit Ubuntu 13.10. Text Editor: Emacs.

I also tried disabling clang and then reinstalling still getting the same errors.


I found the file in "usr / include / linux" and then pasted it into "usr / include", it shows me an error for the same file, but asks for another

In file included from test.c:1:
In file included from /usr/include/stdio.h:74:
/usr/include/libio.h:50:10: fatal error: 'stdarg.h' file not found
#include <stdarg.h>
     ^
1 error generated.

"" , , , , .

, ?


config.h clang. , , :

/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR ""

/* Directories clang will search for headers */
#define C_INCLUDE_DIRS "/usr/include/i386-linux-gnu:/usr/include/i686-linux-gnu:/usr/include"

, , . - , clang?

+4
4

, , clang - "/usr/include/". Linux . - Ubuntu.

clang:

sudo apt-get remove clang

clang-3.3, clang

sudo apt-get install clang-3.3

clang .

+6

: http://clang.llvm.org/doxygen/config_8h_source.html

, config.h Clang. configure.

, .

00010 /* Relative directory for resource files */
00011 #define CLANG_RESOURCE_DIR ""
00012 
00013 /* Directories clang will search for headers */
00014 #define C_INCLUDE_DIRS ""

, , clang.

+1

: http://clang.llvm.org/docs/LibTooling.html#libtooling-builtin-includes

CLang include. , CLang $(dirname/path/to/tool)/../lib/clang/3.3/include, , Linux. Windows $(dirname/path/to/tool)/../bin/clang/3.3/include, , , clang, , bin. 3.7. clang -../lib/clang...

I am sure that the whole clang / lib / clang directory should be in the place where CLang is looking for it.

You can see where clang is looking with the -v switch.

0
source

All Articles