简体   繁体   English

需要帮助在Windows上正确设置CLANG

[英]Need help setting up CLANG on windows Properly

I need some help to set up clang on windows properly. 我需要一些帮助来正确设置窗口上的clang。

I have visual studios 2015 installed. 我安装了视觉工作室2015。 And the Windows SDK. 和Windows SDK。 I recently installed Clang, and ran a very basic hello world through it to make sure it's working correctly. 我最近安装了Clang,并通过它运行了一个非常基本的hello世界,以确保它正常工作。 And it gave me an error I can't make any sense out of. 它给了我一个我无法理解的错误。

Visual Studios will handle this just fine. Visual Studios将处理这个问题。

Here is the error output I've received from clang: 这是我从clang收到的错误输出:

Microsoft Windows [Version 10.0.14393]

C:\Users\Leo>cd C:\Users\Leo\Desktop\Sandbox

C:\Users\Leo\Desktop\Sandbox>clang++ hello.cpp
In file include d from hello.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocnum:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\climits:5:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\yvals.h:8:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\crtdefs.h:10:10: fatal error:
  'corecrt.h' file not found
#include <corecrt.h>
         ^
1 error generated.

C:\Users\Leo\Desktop\Sandbox>

Line 1 in hello.cpp is just: hello.cpp中的第1行只是:

#include <iostream>

So this error isn't making sense to me. 所以这个错误对我来说没有意义。

Type echo %INCLUDE% at the command prompt. 在命令提示符下键入echo %INCLUDE% To see your INCLUDE path. 要查看INCLUDE路径。

Check to make sure your INCLUDE environment variable isn't set to a path that contains a Visual Studio path. 检查以确保您的INCLUDE环境变量未设置为包含Visual Studio路径的路径。 Probably will need to do the same for the LIB environment variable as well. 可能还需要对LIB环境变量执行相同的操作。

I recently got it to work correctly, and compile windows applications. 我最近让它正常工作,并编译Windows应用程序。 Including Directx11 and Directx12. 包括Directx11和Directx12。

Turns out you would need to build Clang under Visual Studios after generating a Cmake project. 事实证明,在生成Cmake项目之后,您需要在Visual Studios下构建Clang。 If you wish to default to 64bit, you need to specify the 64bit version of Visual Studios. 如果您希望默认为64位,则需要指定Visual Studio的64位版本。

Once it's compiled, you need to run clang-cl under the VSbuild tools. 编译完成后,需要在VSbuild工具下运行clang-cl。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM