Matlab R2014a and Visual Studio Professional 2013

11 views (last 30 days)
I have just installed Matlab R2014a, followed by Visual Studio 2013 Professional with Update 1. When I run mex -setup I get the response:
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/win64.
I have verified that visual studio is working correctly by compiling a simple "Hello World" console app, which worked fine.
Looking in C:\Program Files\Matlab\R2014a\bin\win64\mexopts there is no msvc120opts.bat, nor msvc120opts.stp - is that expected?
According to the support site, Visual Studio 2013 should be supported in R2014a: Supported and Compatible Compilers – Release 2014a
  2 Comments
Elena
Elena on 27 Apr 2014
Edited: Elena on 27 Apr 2014
Hi! I have the same problem. My VS2013 and ML2014 are on disk E.
mex.getCompilerConfigurations()
ans =
CompilerConfiguration with properties:
Name: 'Microsoft Visual C++ 2013 Professional (C)'
Manufacturer: 'Microsoft'
Language: 'C'
Version: '12.0'
Location: 'E:\VS\VC\..\'
ShortName: 'MSVC120'
Priority: 'B'
Details: [1x1 mex.CompilerConfigurationDetails]
LinkerName: 'link'
LinkerVersion: ''
MexOpt: 'C:\Users\elena\AppData\Roaming\MathWorks\MATLAB\R2014a...'
I run :
mcc -W cpplib:test1 -T compile:lib test1 -v
Compiler version: 5.1 (R2014a)
Dependency analysis by REQUIREMENTS.
Parsing file "E:\MATLAB_R2013b\Work\PolyValue\test1.m"
(Referenced from: "Compiler Command Line").
Parsing file "E:\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "E:\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Deleting 0 temporary MEX authorization files.
Generating file "test1.h".
Generating file "test1.cpp".
Generating file "test1.exports".
Generating file "E:\MATLAB_R2013b\Work\PolyValue\readme.txt".
Executing command: ""E:\bin\mbuild" -client mbuild -O -v -c "test1.cpp" "DEFFILE=\"test1.def\"" "LINKEXPORT=\"/DLL /def:\"$DEFFILE\"\"" "LDEXT=\".dll\"" "CMDLINE250=\"mt -outputresource:$EXE;2 -manifest $MANIFEST\"""Verbose mode is on.
No MEX options file identified; looking for an implicit selection.
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/win64.
Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.
Error using mcc
Error executing mcc, return status = 1 (0x1).
But I have downloaded SDK on C:\Program Files (x86)\Microsoft SDKs\Cpp REST SDK for Visual Studio 2013\SDK
What can I do?
Ken Atwell
Ken Atwell on 1 May 2014
Elena, start by mex'ing a simple C file (avoiding the added complexity of MATLAB Compiler for now), adding the -v switch to the command line. Copy and paste the output to new Answer to begin a dialog.

Sign in to comment.

Accepted Answer

Ken Atwell
Ken Atwell on 10 Mar 2014
Edited: Ken Atwell on 13 Mar 2014
If you just installed Visual Studio, try rebooting to make sure the environment variables get set up. If that don't help...
Beginning with 14a, MEX infrastructure has changed -- it no longer uses .stp and .bat files, and you don't need to run 'mex -setup' in most situations. Try 'mex -v filename' (-v for verbose output), and update this question with the generated output. The verbose output should help pinpoint why MEX is not finding the compiler.

More Answers (4)

Ian
Ian on 10 Mar 2014
Running mex in verbose mode has identified the issue - I installed visual studio to a non-standard location (on my D: drive), but for some reason, the VS120COMNTOOLS environment variable was pointing to the 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\' directory. Quitting matlab and changing the environment variable to the correct location ('D:\Microsoft Visual Studio 12.0\Common7\Tools\' in my case) fixed the issue.
Thanks Ken

Elena
Elena on 1 May 2014
Hi, Ken! I use ML example (timestwo-file) and run
mex -v timestwo.c
Below are the results
Verbose mode is on.
Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require the use of
-largeArrayDims and remove the -compatibleArrayDims option.
For more information:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
... Looking for compiler 'Microsoft Visual C++ 2013 Professional (C)' ...
... 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 ...Yes ('E:\VS\').
... Looking for file 'E:\VS\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'E:\VS\VC' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.1\').
... 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 ...Yes ('E:\VS\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 12.0 ...Yes ('E:\VS\VC\').
... Looking for environment variable 'VS120COMNTOOLS' ...Yes ('E:\VS\Common7\Tools\').
... Looking for file 'E:\VS\Common7\IDE\devenv.exe' ...Yes.
... 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 ...Yes ('E:\VS\').
... Looking for file 'E:\VS\VC\vcvarsall.bat' ...Yes.
... Looking for folder 'E:\VS\VC' ...Yes.
Found installed compiler 'Microsoft Visual C++ 2013 Professional (C)'.
Options file details
-------------------------------------------------------------------
Compiler location: E:\VS\VC\..\
Options file: C:\Users\elena\AppData\Roaming\MathWorks\MATLAB\R2014a\mex_C_win64.xml
CMDLINE100 : cl /c /Zp8 /GR /W3 /EHs /nologo /MD /O2 /Oy- /DNDEBUG /DMX_COMPAT_32 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE -I"E:\extern\include" -I"E:\simulink\include" E:\work\timestwo.c /FoC:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj
CMDLINE200 : link /nologo /manifest /DLL /EXPORT:mexFunction C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj /LIBPATH:"E:\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /out:timestwo.mexw64
CMDLINE250 : mt -outputresource:timestwo.mexw64;2 -manifest timestwo.mexw64.manifest
CMDLINE300 : del C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj timestwo.exp timestwo.lib timestwo.mexw64.manifest timestwo.ilk
COMPILER : cl
COMPFLAGS : /Zp8 /GR /W3 /EHs /nologo /MD
COMPDEFINES : /DMX_COMPAT_32 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE
MATLABMEX : /DMATLAB_MEX_FILE
OPTIMFLAGS : /O2 /Oy- /DNDEBUG
INCLUDE : -I"E:\extern\include" -I"E:\simulink\include"
DEBUGFLAGS : /Z7
LINKER : link
LINKFLAGS : /nologo /manifest
LINKTYPE : /DLL
LINKEXPORT : /EXPORT:mexFunction
LINKLIBS : /LIBPATH:"E:\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
LINKDEBUGFLAGS : /debug /PDB:"timestwo.mexw64.pdb"
LINKOPTIMFLAGS :
OBJEXT : .obj
LDEXT : .mexw64
SETENV : set COMPILER=cl
set COMPFLAGS=/c /Zp8 /GR /W3 /EHs /nologo /MD /DMX_COMPAT_32 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /DMATLAB_MEX_FILE
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set LINKER=link
set LINKFLAGS=/nologo /manifest /export:%ENTRYPOINT% /DLL /LIBPATH:"E:\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /EXPORT:mexFunction
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%.mexw64.pdb"
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
VCROOT : E:\VS\VC
SDKROOT : C:\Program Files (x86)\Windows Kits\8.1\
VSINSTALLDIR : E:\VS\
VCINSTALLDIR : E:\VS\VC\
PROF_ENV : E:\VS\Common7\IDE\devenv.exe
VCVARSALLDIR : E:\VS\VC
MATLABROOT : E:
ARCH : win64
SRC : E:\work\timestwo.c
OBJ : C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj
OBJS : C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj
SRCROOT : E:\work\timestwo
DEF : C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.def
EXP : timestwo.exp
LIB : timestwo.lib
EXE : timestwo.mexw64
ILK : timestwo.ilk
MANIFEST : timestwo.mexw64.manifest
TEMPNAME : timestwo
EXEDIR :
EXENAME : timestwo
OPTIM : /O2 /Oy- /DNDEBUG
LINKOPTIM :
-------------------------------------------------------------------
Building with 'Microsoft Visual C++ 2013 Professional (C)'.
Set PATH = E:\VS\VC\Bin\amd64;E:\VS\VC\Bin\VCPackages;E:\VS\VC\..\Common7\IDE;E:\VS\VC\..\Common7\Tools;C:\Program Files (x86)\Windows Kits\8.1\\Bin\x64;C:\Program Files (x86)\Windows Kits\8.1\\Bin\x86;;C:\MATLAB701\bin\win32;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin\;C:\Program Files (x86)\Google\Google Apps Sync\;C:\Program Files (x86)\Google\Google Apps Migration\;C:\MATLAB701\bin\win32;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;E:\runtime\win64;E:\bin;E:\MATLAB_R2013b\runtime\win64;E:\MATLAB_R2013b\bin
Set INCLUDE = E:\VS\VC\INCLUDE;E:\VS\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\\include\shared;C:\Program Files (x86)\Windows Kits\8.1\\include\um;C:\Program Files (x86)\Windows Kits\8.1\\include\winrt;E:\extern\include;E:\VS\VC\INCLUDE;E:\VS\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\\include\shared;C:\Program Files (x86)\Windows Kits\8.1\\include\um;C:\Program Files (x86)\Windows Kits\8.1\\include\winrt;E:\extern\include;
Set LIB = E:\VS\VC\Lib\amd64;E:\VS\VC\ATLMFC\Lib\amd64;C:\Program Files (x86)\Windows Kits\8.1\\lib\winv6.3\um\x64;E:\lib\win64;E:\VS\VC\Lib\amd64;E:\VS\VC\ATLMFC\Lib\amd64;C:\Program Files (x86)\Windows Kits\8.1\\lib\winv6.3\um\x64;E:\lib\win64;
Set LIBPATH = E:\VS\VC\Lib\amd64;E:\VS\VC\ATLMFC\Lib\amd64;E:\VS\VC\Lib\amd64;E:\VS\VC\ATLMFC\Lib\amd64;
cl /c /Zp8 /GR /W3 /EHs /nologo /MD /O2 /Oy- /DNDEBUG /DMX_COMPAT_32 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE -I"E:\extern\include" -I"E:\simulink\include" E:\work\timestwo.c /FoC:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj
timestwo.c
link /nologo /manifest /DLL /EXPORT:mexFunction C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj /LIBPATH:"E:\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /out:timestwo.mexw64
Creating library timestwo.lib and object timestwo.exp
mt -outputresource:timestwo.mexw64;2 -manifest timestwo.mexw64.manifest
Microsoft (R) Manifest Tool version 6.3.9600.16384
Copyright (c) Microsoft Corporation 2012.
All rights reserved.
del C:\Users\elena\AppData\Local\Temp\mex_1103397600611329_3300\timestwo.obj timestwo.exp timestwo.lib timestwo.mexw64.manifest timestwo.ilk
MEX completed successfully.
  1 Comment
Elena
Elena on 1 May 2014
ok, I have an answer from support
I run the command:
mex -setup:' *here my path to matlab on disk E* \MATLAB\R2014a\bin\win64\mexopts\msvc2013.xml ' C -client MBUILD
and than
mcc
The result is :
MEX completed successfully.

Sign in to comment.


Royi Avital
Royi Avital on 20 Sep 2014
I have the same issue, Installed VS 2013 on Windows 7. I have MATLAB R2014a and the VS 2013 isn't on the available compilers list.
How can that be fixed?
Thanks.
  5 Comments
Royi Avital
Royi Avital on 21 Sep 2014
I see.
I didn't try the '-v' option. I tried using those manual opts files in Exchange.
It's strange, I can create MEX files using 'coder' yet can't use 'loadlibrary'.
What's wrong with the Visual Studio 2013 (Visual Studio 12.0) integration?
Image Analyst
Image Analyst on 21 Sep 2014
I can't say myself since I have only VS2010.

Sign in to comment.


Mauricio Gruenwaldt
Mauricio Gruenwaldt on 21 Apr 2015
which C compilers may be used for Matlab R2014b running on a 64bit Win 8.1 PC? The proposed free software Microsoft Windows SDK 7.1 only works on PCs with Win 7, isn't? Thanks.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!