MATLAB Library Compiler, Excel Add-in compiling error (error code=-1)

5 views (last 30 days)
Hello! I have developed some models in Matlab, but the users of these models don’t use Matlab, so I try to compile them into Excel Add-in. I learnt how to do it from Youtube, but there are always compiling errors. I have installed the “MinGW-w64 C/C++ compiler” as required. (I just use the example code from the tutorial for Excel Add-in compiler, so there can't be anything wrong with the code itself). The log file is shown as below:
mcc -W 'excel:AdotB,Class1,1.0' -T link:lib -b -d C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing -v class{Class1:C:\Users\Cha.Li\Documents\MATLAB\AdotB.m}
Compiler version: 6.3 (R2016b)
Dependency analysis by REQUIREMENTS.
Warning: Component "AdotB_1_0" will be registered for the current user only.
Applications that run with full administrative privileges cannot access the component.
To register the component for all users, run MATLAB or the mcc command as Administrator.
[Warning: Adding path "C:\Users\Cha.Li\Documents\MATLAB" to Compiler path
instance.]
Parsing file "C:\Users\Cha.Li\Documents\MATLAB\AdotB.m"
(Referenced from: "Compiler Command Line").
Deleting 0 temporary MEX authorization files.
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB_idl.idl".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\Class1_com.hpp".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\Class1_com.cpp".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB_dll.cpp".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.def".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.rc".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.bas".
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.xla".
[Warning: The Excel Add-in
C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.xla could not be
generated. Enable "Trust access to the VBA project object model" in the Macro
Settings option of the Excel Trust Center to fix the issue.]
[> In makeExcelAddIn (line 64)]
Generating file "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\readme.txt".
Executing command: ""C:\Program Files\MATLAB\R2016b\bin\mbuild" -client mbuild_com OUTDIR"=""C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing""" -O -v -output "AdotB_1_0" -I"C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing" COMIDL"=""C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB_idl.idl""" "mclxlmain.lib" "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\Class1_com.cpp" "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB_dll.cpp" DEFFILE"=""C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.def""" RCFILE"=""C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.rc""" RESFILE"=""C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing\AdotB.res""" CMDLINE275"=""""$MATLABROOT\runtime\$ARCH\mwregsvr.exe"" /useronly $EXE""" LINKFLAGS"=""$LINKFLAGS delayimp.lib /delayload:mclmcrrt9_1.dll""" -outdir "C:\Users\Cha.Li\Documents\MATLAB\AdotB\for_testing""Verbose mode is on.
No MEX options file identified; looking for an implicit selection.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2013' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2013'.
... Looking for compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft SDK 7.1' ...
... Looking for environment variable 'ICPP_COMPILER15' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft SDK 7.1'.
... Looking for compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2012' ...
... Looking for environment variable 'ICPP_COMPILER15' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2012'.
... Looking for compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2013' ...
... Looking for environment variable 'ICPP_COMPILER15' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2013'.
... Looking for compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2015' ...
... Looking for environment variable 'ICPP_COMPILER15' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2015 for C++ with Microsoft Visual Studio 2015'.
... Looking for compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft SDK 7.1' ...
... Looking for environment variable 'ICPP_COMPILER16' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft SDK 7.1'.
... Looking for compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2012' ...
... Looking for environment variable 'ICPP_COMPILER16' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2012'.
... Looking for compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2013' ...
... Looking for environment variable 'ICPP_COMPILER16' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2013'.
... Looking for compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2015' ...
... Looking for environment variable 'ICPP_COMPILER16' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2016 for C++ with Microsoft Visual Studio 2015'.
... Looking for compiler 'MinGW64 Compiler (C++)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2016b\3P.instrset\mingw_492.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2016b\3P.instrset\mingw_492.instrset\bin\g++.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2016b\3P.instrset\mingw_492.instrset' ...Yes.
Found installed compiler 'MinGW64 Compiler (C++)'.
... Looking for compiler 'Microsoft Visual C++ 2012' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2012'.
... Looking for compiler 'Microsoft Visual C++ 2013 Professional' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2013 Professional'.
... Looking for compiler 'Microsoft Visual C++ 2015 Professional' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015 Professional'.
... Looking for compiler 'Microsoft Windows SDK 7.1 (C++)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1' InstallationFolder ...No.
Did not find installed compiler 'Microsoft Windows SDK 7.1 (C++)'.
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 http://www.mathworks.com/support/compilers/R2016b/win64.html.
Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.

Answers (1)

Harsheel
Harsheel on 9 Aug 2017
MinGW cannot be used to create Excel addins in R2016b. You need to install a compiler that has "tick" mark under "Excel addin" column (2nd column) on page 2 of this supported compiler page: Supported Compilers

Categories

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

Community Treasure Hunt

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

Start Hunting!