Just wondering if anyone has experience with the above?
In my mind, it would be great if modules corresponding to each of the STL header files could exist in a standard location similar to the current header files. Ideally, one should only have to have the following in a file, without any further effort:
import <iostream>;
Using g++ the method I used was to have a header file:
1 2
|
//mod-iostream.h
#include <iostream>
|
Which I compile into a module. I the idea was to do this for each STL header file.
However, on my system it creates files in a ~/projects/module-test/,/gcmcache folder . Note the comma, I am guessing that is a little bug -> did they mean to have .gcmcache as a hidden folder? So I am thinking this setup is geared toward users creating their own modules from their own code.
I have tried to copy/move/create these files to the same directory as the STL headers, but to no avail, they seem tied to the cwd. In hindsight it does mention this in the documentation. This is a little painful in that one would have to at least copy the created files from one project to another.
With clang++, it has a whole procedure for module mapping - I am yet to try this out. Clang++ also has other procedures which create pre-compiled module files (*.pcm) as an intermediate compilation/linking step.
So with both g++ and clang++ there are hoops to jump through. I realise that all this is experimental at the moment, but MS seems to compiled all the STL headers, it would be great if g++ and clang++ could do the same.
Has anyone else done anything different to the above?
Btw, I have just built g++ 12.0 and clang++ 15.0 , so will see how that goes.
I found this:
https://blog.ecosta.dev/en/tech/cpp-modules-with-clang
Will try it !