使用clang编译c文件时出现错误?

时间:2018-09-28 10:22:42

标签: c clang clang++ stdio

当我使用clang编译c文件时,发生错误。 C文件很简单。 main.c

#include <STDIO.H>

int main() {
    printf("Hello\n");
    return 0;
}

我在Windows中使用了以下命令。

  

clang main.c

错误

C:\Users\bo\Desktop>clang main.c
In file included from main.c:1:
F:\Microsoft Visual Studio\VC98\Include\STDIO.H:70:22: error: typedef
  redefinition with different types ('unsigned int' vs 'unsigned long long')

typedef unsigned int size_t;
                 ^
1 error generated.

1 个答案:

答案 0 :(得分:0)

英语不是我的母语,也许我会在 表达,我会尽力表达清楚以帮助您。

我看到您想在Windows上使用clang编译器,命令行中的警告说明您的Visual Studio库版本对于LLVM版本而言太旧,我不认为VisualC ++ 6.0是您正在使用的IDE现在,也许您只是安装并收起了它。此错误可能是VC6.0引起的。

因此,我建议检查您的环境变量,可能有一个“ include”变量,其文件目录为“ F:\ Microsoft Visual Studio \ VC98 \ Include \”,如该警告中所示。只需删除即可,如果还有更多包含VC6.0的变量(例如“路径”),则在不需要时删除包含VC6.0的变量。

尝试使用VS2019而不是VC6.0,它可以为Clang提供最新的Windows SDK。

相关问题