lang不编译C程序?

迪帕克

在c语言中进行编程时,大多数时候我都会使用clang进行编译。突然,它停止工作了。每当我尝试编译某些内容时,它都会为我提供此输出假设文件名为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.

test.c的来源是:

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

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

注意:在其他编译器(例如gcc)上,它仍然可以工作。我应该怎么做才能使c声恢复正常?

如果您需要有关系统的任何信息:我正在使用32位Ubuntu 13.10。文字编辑器:Emacs。

我也尝试卸载clang,然后重新安装仍然遇到相同的错误。


我在“ usr / include / linux”中找到该文件,然后将其粘贴到“ usr / include”中,它现在没有显示相同文件的错误,但要求另一个文件

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.

现在,我尝试搜索新文件“”,并在不同的文件夹中找到多个具有相同名称的文件,这使我感到困惑,这是我需要将粘贴复制到clang想要的目录中的正确选择。

还有其他方法可以解决头文件的问题吗?


现在,我找到了lang的config.h文件。文件中负责包含文件的两个变量及其当前值如下:

/* 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吗?

迪帕克

花了一些时间后,我发现由于“ / usr / include /”目录中缺少头文件,导致clang无法正常工作。许多其他Linux用户也面临同样的问题。就我而言,这是由于更新到Ubuntu的新版本而发生的。

我通过以下方式删除了叮当声:

sudo apt-get remove clang

然后安装了clang-3.3,这是clang的另一个版本

sudo apt-get install clang-3.3

现在c对我来说很好用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章