简体   繁体   中英

Enable C++ Modules TS in clang-cl

I am using clang (from LLVM version 7.00) on Windows via clang-cl .

I am trying to get C++ Modules to work. I have tried the clang command line arguments -fmodules-ts and -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).

All options result in the error 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 ?

使用选项-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:

https://llvm.org/builds/

With Visual studio 2019 / windows - checkout following git repository:

git clone https://github.com/NTSFka/CMakeCxxModules.git

Open folder with Visual studio 2019, from Configuration > Managed configurations

Add x64-CLang-Debug configuration, select it.

Check "Show advanced variables" and in CMAKE_C_COMPILER select

C:/Program Files/LLVM/bin/clang.exe

and from CMAKE_CXX_COMPILER select

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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