Why do I have problems when trying to import a header unit?
I used VS Developer PowerShell to create a header unit file from a header file.
cl /std:c++20 /exportHeader /headerName:quote HeadersBase.h
Not sure if that was the right thing to do.
Then I created an empty project to see if I can import the header unit successfully.
// ModulesBase.ixx
export module ModulesBase; // command-line error: no mapping specified for C:/Exports/HeadersBase.h.ifc
import "HeadersBase.h"
using namespace std;
export void MyFunc() {}
In the properties of the Modulebase file, I used these in the command-line
/std:c++20 /headerUnit C:\Exports\HeadersBase.h=C:\Exports\HeadersBase.h.ifc /headerUnit:quote HeadersBase.h=C:\Exports\HeadersBase.h.ifc
When I build, I get errors
E3343 ommand-line error: no mapping specified for Test C:\Projects\Test\Test\ModulesBase.ixx 1 Warning C5210 'C:\Exports\HeadersBase.h.ifc' is not a valid header unit reference; ignoring Test C:\Projects\Test\Test\ModulesBase.ixx 1 Error C1083 Cannot open header unit file: 'HeadersBase.h': No such file or directory Test C:\Projects\Test\Test\ModulesBase.ixx 8 Warning MSB8074 Cannot read Module Dependencies file x64\Debug\ModulesBase.ixx.module.json: Expecting element 'root' from namespace ''.. Encountered 'None' with name '', namespace ''. The build order might be incorrect. Test C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 486 Error C1190 System::Object not found, missing /clr option or missing import of standard assemblies? Test C:\Projects\Test\Test\ModulesBase.ixx 3