Windows 10:Clang,“ stdio.h”未找到 [英] Windows 10: Clang, "stdio.h" not found

查看:611
本文介绍了Windows 10:Clang,“ stdio.h”未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Win10上安装了LLVM和Clang-3.9.0。我也安装了MinGW。

I have installed LLVM and Clang-3.9.0 on Win10. I have MinGW installed as well.

我已将C代码放在 D:驱动器中。

I have put my C code in 'D:' drive.

我可以使用gcc和g ++进行编译我的代码。但是当我使用clang时,我得到:

I can use gcc and g++ to compile my code. But when I use clang I get:

clang -cc1 version 3.9.0 based upon LLVM 3.9.0 default target x86_64-pc-windows-msvc
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
#include "..." search starts here:
#include <...> search starts here:
 C:\Program Files\LLVM\bin\..\lib\clang\3.9.0\include
 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
 C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A
End of search list.
 hello.c:1:10: fatal error: 'stdio.h' file not found
 #include "stdio.h"
             ^
 1 error generated.

由于我可以使用gcc和g ++,因此我的环境变量设置正确。但是后来我无法强迫clang进入C:\MinGW。

As I can use gcc and g++, my environment variable settings are right. But then I am not able to force clang to look into C:\MinGW.

我尝试在 C:\Program中手动复制粘贴整个MinGW文件夹。文件\LLVM\bin\ \lib\clang\3.9.0\include 分别存在,但没有工作。我想尝试,但是在3.9.0中我找不到, clang / lib / Frontend / InitHeaderSearch.cpp

I tried copy pasting the whole MinGW folder manually in C:\Program Files\LLVM\bin\ and \lib\clang\3.9.0\include separately, but it did not work. I wanted to try this, but in 3.9.0 I cannot find, clang/lib/Frontend/InitHeaderSearch.cpp.

反正还有解决方法吗?

注意:我已经尝试过< stdio.h> stdio.h 仍然会得到相同的错误。

Note: I have tried <stdio.h> and "stdio.h" both, and I still get the same error.

推荐答案

好,所以直到现在,Windows中使用Clang / LLVM的东西。从3.7左右开始,情况发生了变化:Clang / LLVM二进制文件是使用Visual Studio和Visual Studio构建的。据我了解,不需要MinGW。

Okay, so until now things with Clang/LLVM in Windows. Starting 3.7 or so things have changed: Clang/LLVM binaries are built with Visual Studio and for Visual Studio. No need for MinGW, as far as I understand.

因此,现在可以通过可用的二进制文件安装LLVM。确保您先前已安装VS2015(或2013及更高版本)。

So now install LLVM via the binary files available. Make sure that you have VS2015 (or 2013 and more) previously installed. When LLVM is being installed add it in the path when prompted.

现在,在完成所有操作后,启动VS2015的开发人员命令提示符(单击 start -> Visual Studio 2015-> VS2015开发人员指挥官提示。我想,您会选择适合您要求的任何东西)。现在,从这里尝试使用 LLVM网站上列出的clang命令

Now after all that has been done, start the developer commander prompt for VS2015 (got to start -> Visual Studio 2015 -> Developer Commander Prompt for VS2015. I guess, you will choose whatever suits for your requirements). Now from here try using the clang commands listed on LLVM website.

但是像 lli llvm-dis llc这样的命令仍然无法运行。

However commands like lli, llvm-dis and llc still cannot be ran.

此外,LLVM网站仍然表示需要用于Windows的GNU工具。但是我不知道是为了什么!

Also, LLVM website still says that GNU tools for windows are needed. But I do not know what for!

这篇关于Windows 10:Clang,“ stdio.h”未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆