import std.core;
int main()
{
std::cout << "Hello World!\n";
}
If I compile this code from the command line, using this
cl /c /O2 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /EHsc /MD /std:c++latest /Gd /TP /experimental:module /ifcSearchDir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29304\ifc\x64\Release" ConsoleApplication1.cpp
it compiles and links fine.
If I compile the same code using the IDE and the same options, the Output window shows this result.
1>cl /c /O2 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /EHsc /MD /std:c++latest /Gd /TP /experimental:module /ifcSearchDir "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29304\ifc\x64\Release" ConsoleApplication1.cpp
1>ConsoleApplication1.cpp
1>ConsoleApplication1.cpp(1): fatal error C1011: cannot locate standard module interface. Did you install the library part of the C++ modules feature in VS setup?
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
Can anybody enlighten me to what is going on here? What am I forgetting?
I found a workaround, if I open a Developer Command Prompt or run vcvarsall.bat, I can then start Visual Studio from the command line using "devenv" and then modules will work. I suspect the environment is not setup correctly when Visual Studio is started normally.