如何为Windows开发设置Clang [英] How to Set up Clang for Windows Development

查看:128
本文介绍了如何为Windows开发设置Clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力让VSCode和Clang成立,但我有一段时间试图想出这个。  我并不是很喜欢Visual Studio 20xx的重量级加权,这就是我选择不再使用它的原因。

I'm trying to get VSCode and Clang set up, but I'm having one hell of a time trying to figure this one out.  And I'm not really much of a fan with Visual Studio 20xx's heavy weightedness, which is why I opted out of using it.

Clang的文档确实没有提到需要做的任何特殊事情。但是在尝试链接时似乎存在一些复杂性。为了测试我的Clang / LLVM安装,我创建了一个简单的hello world应用程序,它只创建了一个
简单的窗口,该窗口被涂成白色。



http:// pastebin.com/r9gFxfXw

Clang's documentation really doesn't mention anything special that will need to be done. But it appears that there are some complications when trying to link. To test my Clang/LLVM installation, I made a simple hello world application that just creates a simple Window that's been painted white.

http://pastebin.com/r9gFxfXw

我正在从VS Build Tools命令提示符下运行Clang编译器。根据输出,它正好检测库...或者至少我认为它不会向"Windows.h"发送错误。标题。



因此,这涉及链接问题。我假设链接所需的目录将包含在路径中....但我猜不是。我无法弄清楚我应该链接到哪里,因为通常会有不同版本的库。



I am running the Clang compiler from VS Build Tools command prompt. According to the output, it's detecting the libraries just fine... or at least I think as it does not throw an error to the "Windows.h" header.

So, this revolves around the issue of linking. I'd assume that the directories needed for linking would be included in the path.... but I guess not. And I can't quite figure out where I should link to as there will normally be different versions of the libraries.

最后,我希望能够使用Clang编译器创建一个directx11,可能还有12个应用程序。但是我不确定它是否能够成功链接到库。

And lastly, I'd like to be able to create a directx11, and possibly 12 application using the Clang compiler. However I am unsure if it's currently able to successfully link to the libraries.

推荐答案

你好
moonshineTheleocat,

感谢您在此处发帖。

>>我正在从VS Build Tools命令提示符运行Clang编译器。根据输出,它正好检测库...或者至少我认为它不会向"Windows.h"发送错误。标题。

您使用了哪种构建工具? MSBuild或CMake?

Which build tool did you use? MSBuild or CMake?

对于这种情况,我建议你使用CMake工具生成你将用来构建的项目文件。它有 set_directory_properties 或  target_link_libraries
命令设置链接目录或类似库。

For this case, I suggest you use CMake tool which generates the project files you will use to build with. It has set_directory_properties or  target_link_libraries command to set link directories or lik libraries.

以下是一些文档关于如何使用CMake构建LLVM作为参考。

Here are some documents about how to build LLVM with CMake for you as references.

http://llvm.org /docs/GettingStartedVS.html

http://llvm.org/docs /CMake.html

您还可以使用Clang与Microsoft CodeGen构建跨平台应用程序。

You could also use Clang with Microsoft CodeGen to build cross-platform applications.

有关详细信息,请请参阅此文档。

For more information, please refer to this document.

https://blogs.msdn.microsoft.com/vcblog/2016/03/31/clang-with-microsoft-codegen-march-2016-released/

希望如此可以帮助你。

最好的问候,

Sera Yu


这篇关于如何为Windows开发设置Clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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