I use clang to compile most of the times when programming in c. Suddenly it has stopped working. Whenever I try to compile something it gives me this output 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 get clang working back?
In case you need any info about system: I am using Ubuntu 13.10 32-bit. Text editor : Emacs.
I also tried to un-installing clang and then reinstalling still get the same errors.
I found the file in "usr/include/linux" and then pasted it into "usr/include" it doest show me error for same file now but asks for another one
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.
Now I tried to search for the new file "" and found more than 1 file with same name in different folder which makes it confusing which is the right one I need to copy paste in the directory clang wants.
Is there any other way by which I can fix the issue with header files?
Now i have found the config.h file for clang. The two variables responsible for include files are as follows in the file with their current values:
/* 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"
but I have no clue what value i should replace to get it working. Is these any way I can completely reconfigure clang?
After spending some time I found that clang was not working due to missing header files in "/usr/include/" directory. Many other Linux users are also facing same problems. In my case this happened due to updating to new release of Ubuntu.
I removed clang by:
sudo apt-get remove clang
And then installed clang-3.3 which is different version of clang
sudo apt-get install clang-3.3
Now clang is working fine for me.