我是Clang的新手。

我已经使用this article开始使用预编译的Clang 3.5.0和Visual Studio 2012。

当我尝试编译以下代码时:

// hello.c
#include <stdio.h>

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

像这样
C:\..> clang -c hello.c -emit-llvm -o hello.bc

我有一个错误:
hello.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.

如何使预编译的Clang看到Visual Studio header ?

最佳答案

gmlacrosse 是正确的。我需要将包含目录添加到命令行。
-I命令行开关解决了该问题:
C:\..> clang -c hello.c -emit-llvm -o hello.bc -I "c:\Program Files\Microsoft Visual Studio 11.0\VC\include"

关于c++ - 预编译的Clang无法看到Visual Studio header ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27638069/

10-11 22:49
查看更多