Clangs C++ Module TS support: How to tell clang++ where to find the module file?

ぃ、小莉子 提交于 2019-12-04 05:44:41
Julian Kranz

You can compile it as follows:

clang++ -std=c++1z -fmodules-ts --precompile -o myclass.pcm myclass.cppm 
clang++ -std=c++1z -fmodules-ts -fmodule-file=myclass.pcm -o modules_test main.cpp

However, this can't be how it's meant to work since you'd manually need to encode the dependency hierarchy of your modules in the calls to the compiler; I'd be very interested in the correct answer to this question :-).

-fprebuilt-module-path works even though it fires a warning: "argument unused during compilation: '-fprebuilt-module-path=.'"

The complete command was:

clang++-4.0 -std=c++1z -fmodules-ts -fprebuilt-module-path=. -o modules_test main.cpp
ervinbosenbacher

as of 27th of December, 2017 I have checked out the latest llvm branch, built it on my macbook and then eexecuted the following:

./../bin/clang++ -std=c++17 -fmodules-ts --precompile -o myclass.pcm myclass.cppm ./../bin/clang++ -std=c++17 -fmodules-ts -c myclass.pcm -o myclass.o ./../bin/clang++ -std=c++17 -fmodules-ts -fprebuilt-module-path=. -o main main.cpp hello.o

and tada, worked prefectly without any warnings or errors.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!