Why is MATLAB R2018b not using the compiler that I selected for a COM component?

6 views (last 30 days)
I have VS2013 and VS2015 installed. I am trying to compile a deployed application (COM Server) using mcc. It uses VS2015. When I compile, I get an internal compiler error:
cl /c /GR /W3 /EHsc- /nologo /MT /O2 /Oy- /DNDEBUG /DMATLAB_DEFAULT_RELEASE=R2017b /DUSE_MEX_CMD /DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 -I"mcr_solver" -I"C:\Apps\matlab95\extern\include" -I"C:\Apps\matlab95\simulink\include" -I"mcr_solver" -I"C:\Apps\matlab95\extern\include\win64" -I"C:\Apps\matlab95\extern\include" -I"mcr_solver" "H:\Projects\SRA\SRA\mcr_solver\Solver_com.cpp" /FoC:\Users\<username>\AppData\Local\Temp\mex_314603302956460_14840\Solver_com.obj
Solver_com.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(100): error C2737: 'std::is_same_v': 'constexpr' object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(100): error C2998: 'const bool std::is_same_v': cannot be a template definition
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(245): error C2737: 'std::is_integral_v': 'constexpr' object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(245): error C2998: 'const bool std::is_integral_v': cannot be a template definition
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(282): error C2737: 'std::is_floating_point_v': 'constexpr' object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(282): error C2998: 'const bool std::is_floating_point_v': cannot be a template definition
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(295): error C2737: 'std::is_arithmetic_v': 'constexpr' object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(295): error C2998: 'const bool std::is_arithmetic_v': cannot be a template definition
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstddef(697): error C2737: 'std::is_function_v': 'constexpr' object must be initialized
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xstddef(697): error C2998: 'const bool std::is_function_v': cannot be a template definition
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(524): error C2275: '_To': illegal use of this type as an expression
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(521): note: see declaration of '_To'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(526): note: see reference to class template instantiation 'std::is_assignable<_To,_From>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(524): error C2275: '_From': illegal use of this type as an expression
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(522): note: see declaration of '_From'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(524): error C3861: '__is_assignable': identifier not found
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(524): error C2975: '_Val': invalid template argument for 'std::integral_constant', expected compile-time constant expression
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xtr1common(21): note: see declaration of '_Val'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1245): error C2061: syntax error: identifier '__make_integer_seq'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1249): error C2065: '_Vals': undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1249): error C2975: '_Vals': invalid template argument for 'std::integer_sequence', expected compile-time constant expression
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1190): note: see declaration of '_Vals'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1252): error C2061: syntax error: identifier 'make_integer_sequence'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_traits(1261): error C2631: 'identity': a class or enum cannot be defined in an alias template
H:\Projects\SRA\SRA\mcr_solver\Solver_com.cpp: fatal error C1903: unable to recover from previous error(s); stopping compilation
Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\amd64\cl.exe. You will be prompted to send an error report to Microsoft later.
INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\amd64\cl.exe'
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.
 
I tried forcing MBUILD to use VS2013 like this:
>> mex -setup:C:\Users\<username>\AppData\Roaming\MathWorks\MATLAB\R2018b\MBUILD_C_win64.xml C -client MBUILD
However, it still uses VS2015 in the compile process. How do I get it to use VS2013?
 

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 1 Oct 2020
Because a COM component is being compiled, "mbuild" compiler needs to be configured. To do this, use the following to set up your your "mbuild" compiler rather than "mex -setup":
>> mbuild -setup -client mbuild_com
For more information about 'mbuild', please refer to the following link:
 

More Answers (0)

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!