[英]Enable C++ Modules TS in clang-cl
I am using clang (from LLVM version 7.00) on Windows via clang-cl
.我通过
clang-cl
在 Windows 上使用 clang(来自 LLVM 7.00 版)。
I am trying to get C++ Modules to work.我试图让 C++ 模块工作。 I have tried the clang command line arguments
-fmodules-ts
and -fmodules
.我已经尝试了 clang 命令行参数
-fmodules-ts
和-fmodules
。
I have also tried the msvc
command line arguments (which work under MSVC - I am using 15.8.5) /experimental:module /module:interface
(which would be the normal way for non-experimental options).我还尝试了
msvc
命令行参数(在 MSVC 下工作 - 我使用的是 15.8.5) /experimental:module /module:interface
(这将是非实验选项的正常方式)。
All options result in the error clang-cl.exe: warning: unknown argument ignored in clang-cl
.所有选项都会导致错误
clang-cl.exe: warning: unknown argument ignored in clang-cl
。
Anyone know if it's possible to use the C++ Modules TS under clang-cl
?有人知道是否可以在
clang-cl
下使用 C++ Modules TS 吗?
使用选项-Xclang
,如下所示:
clang-cl -Xclang -fmodules
To enable C++ modules support you will need latest clang 10.0 release (suspect so), that one can be downloaded from this URL, as latest snapshot build:要启用 C++ 模块支持,您将需要最新的 clang 10.0 版本(怀疑如此),可以从这个 URL 下载,作为最新的快照构建:
https://llvm.org/builds/
With Visual studio 2019 / windows - checkout following git repository:使用 Visual Studio 2019 / windows - 在 git 存储库之后结帐:
git clone https://github.com/NTSFka/CMakeCxxModules.git
Open folder with Visual studio 2019, from Configuration > Managed configurations使用 Visual Studio 2019 打开文件夹,从配置 > 托管配置
Add x64-CLang-Debug configuration, select it.添加 x64-CLang-Debug 配置,选择它。
Check "Show advanced variables" and in CMAKE_C_COMPILER
select选中“显示高级变量”并在
CMAKE_C_COMPILER
选择
C:/Program Files/LLVM/bin/clang.exe
and from CMAKE_CXX_COMPILER
select并从
CMAKE_CXX_COMPILER
选择
C:/Program Files/LLVM/bin/clang++.exe
Compile program.编译程序。
What I have tested by myself intellisense works, but still some text is displayed in red color (vs2019, 16.3.7), situation might change with Visual studio updates.我自己测试过的智能感知有效,但仍有一些文本以红色显示(vs2019,16.3.7),情况可能会随着 Visual Studio 更新而改变。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.