I am trying the experimental implementation for modules in Visual Studio 2017, version 15.4.4. I followed the instructions described here https://blogs.msdn.microsoft.com/vcblog/2017/05/05/cpp-modules-in-visual-studio-2017/. I was able to make this run pretty quickly in a console application.
import std.core;
int main()
{
std::cout << "Hello modules!" << std::endl;
return 0;
}
Importing and using the available standard modules is not a problem (as far as I tried to far).
However, when I define my own module, nothing works. I added a file system.ixx (item type C/C++ compiler), with the following content:
import std.core;
export import system.io;
export struct console
{
void write(std::string_view text) { std::cout << text; }
void write_line(std::string_view text) { std::cout << text << std::endl; }
};
when I add import system.io to main.cpp
import std.core;
import system.io;
int main()
{
std::cout << "Hello modules!" << std::endl;
return 0;
}
I get the following errors:
1>system.ixx
1>system.ixx(2): error C2230: could not find module 'system.io'
1>main.cpp
1>main.cpp(2): error C2230: could not find module 'system.io'
I also added /module:reference system.io.idf to the compiler options, but there is no system.io.idf file generated out of system.ixx.
I know this is experimental and has lots of issues, but I was wondering was should I do to make this simple thing work.