MATLAB: Error while compiling generic COM component

generic com componentMATLABMATLAB CompilerMATLAB Compiler SDKmingw64

Although I have the MinGW64 compiler installed (and I can successfully compile standalone executables and .NET assemblies), I cannot compile a "Generic COM component".
I get tho following error message:
Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.
The PackagingLog shows the following entries for the MinGW compiler found:
… Looking for compiler 'MinGW64 Compiler (C++)' …
… Looking for environment variable 'MW_MINGW64_LOC' …Yes ('C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset').
… Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset\bin\g++.exe' …Yes.
… Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset' …Yes.
Found installed compiler 'MinGW64 Compiler (C++)'.
… Looking for compiler 'MinGW64 Compiler with Windows 10 SDK or later (C++)' …
… Looking for environment variable 'MW_MINGW64_LOC' …Yes ('C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset').
… Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset\bin\g++.exe' …Yes.
… Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset' …Yes.
Some lines later in the log it says however:
No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; visit http://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html. For more options, visit https://www.mathworks.com/support/compilers.
The log ends with the above stated error message.
How can I compile a generic COM component? What am I doing wrong?

Best Answer

Matlab support provided the solution for this problem:
"(...)
For generating a COM component with MinGW as compiler you need Windows SDK 10 in addition:
(...)"
Related Question