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

问题描述 投票:0回答:2

当我使用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.
c clang clang++ stdio
2个回答
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。

© www.soinside.com 2019 - 2024. All rights reserved.