Skip to content

Instantly share code, notes, and snippets.

@amroamroamro
Last active July 25, 2020 09:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amroamroamro/ea4541d5621f3d62e67029e393e523a0 to your computer and use it in GitHub Desktop.
Save amroamroamro/ea4541d5621f3d62e67029e393e523a0 to your computer and use it in GitHub Desktop.
MEX config files for Microsoft Visual Studio 2017

XML configuration files for compiling MATLAB MEX-files using VS2017. Tested on Windows 10 64-bit with MATLAB R2016b and Visual Studio 2017 (Enterprise Edition), but it should also work with the Community Edition.

  1. First copy the files to MATLABROOT\bin\win64\mexopts (this might trigger a UAC prompt).
  2. Next run mex -setup and mex -setup C++ in MATLAB, and select VS2017 compilers.
  3. Finally test the new settings with a sample MEX-file:
>> mex -v -largeArrayDims test.cpp
>> test()
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[])
{
    plhs[0] = mxCreateDoubleScalar(42);
}
<?xml version="1.0" encoding="UTF-8" ?>
<config
Name="Microsoft Visual C++ 2017 Professional (C)"
ShortName="MSVC150"
Manufacturer="Microsoft"
Version="15.0"
Language="C"
Priority="A"
Location="$VSINSTALLDIR">
<Details
CompilerExecutable="$COMPILER"
CompilerFlags="$COMPFLAGS"
CompilerDefines="$COMPDEFINES"
OptimizationFlags="$OPTIMFLAGS"
DebugFlags="$DEBUGFLAGS"
IncludeFlags="$INCLUDE"
LinkerExecutable="$LINKER"
LinkerFlags="$LINKFLAGS"
LinkerOptimizationFlags="$LINKOPTIMFLAGS"
LinkerDebugFlags="$LINKDEBUGFLAGS"
LinkerLibraries="$LINKLIBS"
CommandLineShell="$VCVARSALLDIR\VCVARSALL.BAT"
CommandLineShellArg="x64"
CompilerDefineFormatter="/D%s"
LinkerLibrarySwitchFormatter="lib%s.lib;%s.lib"
LinkerPathFormatter="/LIBPATH:%s"
LibrarySearchPath="$$LIB;$$LIBPATH;$$PATH;$$INCLUDE;$MATLABROOT\extern\lib\$ARCH\microsoft"
/>
<!-- Switch guide: http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=vs.71).aspx -->
<vars
CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
CMDLINE300="del $OBJ $EXP $LIB $MANIFEST $ILK"
COMPILER="cl"
COMPFLAGS="/Zp8 /GR /W3 /EHs /nologo /MD"
COMPDEFINES="/D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 $MATLABMEX"
MATLABMEX="/DMATLAB_MEX_FILE"
INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\simulink\include&quot;"
OPTIMFLAGS="/O2 /Oy- /DNDEBUG"
DEBUGFLAGS="/Z7"
LINKER="link"
LINKFLAGS="/nologo /manifest"
LINKTYPE="/DLL"
LINKEXPORT="/EXPORT:mexFunction"
LINKLIBS="/LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; 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"
LINKOPTIMFLAGS=""
LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME$LDEXT.pdb&quot;"
OBJEXT=".obj"
LDEXT=".mexw64"
SETENV="set COMPILER=$COMPILER
set COMPFLAGS=/c $COMPFLAGS $COMPDEFINES
set OPTIMFLAGS=$OPTIMFLAGS
set DEBUGFLAGS=$DEBUGFLAGS
set LINKER=$LINKER
set LINKFLAGS=$LINKFLAGS /export:%ENTRYPOINT% $LINKEXPORT $LINKTYPE $LINKLIBS
set LINKDEBUGFLAGS=/debug /PDB:&quot;%OUTDIR%%MEX_NAME%$LDEXT.pdb&quot;
set NAME_OUTPUT=/out:&quot;%OUTDIR%%MEX_NAME%%MEX_EXT%&quot;"
/>
<client>
<engine
LINKLIBS="$LINKLIBS libeng.lib"
LINKEXPORT=""
LDEXT=".exe"
LINKTYPE=""
MATLABMEX=""
/>
<mbuild
CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
CMDLINE250="mt -outputresource:$EXE;1 -manifest $MANIFEST"
CMDLINE300="del $MANIFEST &quot;$TEMPNAME.map&quot;"
LINKFLAGS="/nologo /manifest"
LINKLIBS="/MACHINE:AMD64 /LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; mclmcrrt.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"
INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
COMPFLAGS="-MD -Zp8 -GR -W3 -EHsc- -Zc:wchar_t- -nologo"
COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
OPTIMFLAGS="-O2 -DNDEBUG"
LINKEXPORT=""
LDEXT=".exe"
MATLABMEX=""
LINKTYPE=""
LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME.pdb&quot;"
/>
<mbuild_com
CMDLINE000="copy &quot;$MATLABROOT\extern\include\$ARCH\mwcomutil.tlb&quot; &quot;$OUTDIR&quot;"
CMDLINE001="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; mwcomtypes.idl"
CMDLINE002="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; &quot;$COMIDL&quot;"
CMDLINE100="$COMPILER $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $COMPINCLUDE $SRC /Fo$OBJ"
CMDLINE150="rc /fo &quot;$RESFILE&quot; &quot;$RCFILE&quot;"
CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
CMDLINE275="&quot;$MATLABROOT\runtime\$ARCH\mwregsvr.exe&quot; $EXE"
CMDLINE300="del $MANIFEST &quot;$OUTDIR\mwcomutil.tlb&quot; &quot;$RESFILE&quot;"
OUTDIR="."
INCLUDE="$INCLUDE -I&quot;$OUTDIR&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
COMPFLAGS="/c /GR /W3 /EHsc- -Zc:wchar_t /nologo /MT"
COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
COMPINCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$OUTDIR&quot;"
LINKEXPORT="/DLL /def:&quot;$DEFFILE&quot;"
LINKLIBS="/MACHINE:AMD64 $LINKLIBS mclmcrrt.lib &quot;$RESFILE&quot;"
LDEXT=".dll"
USERONLY=""
LINKTYPE=""
MATLABMEX=""
/>
</client>
<locationFinder>
<!-- VCROOT = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017 -->
<VCROOT>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<fileExists name="$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" />
<dirExists name="$$\..\..\.." />
<cmdReturns name="set &quot;vcroot=$$&quot; &amp; for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @call echo %vcroot%\VC\Tools\MSVC\%a" />
<fileExists name="$$\bin\HostX64\x64\cl.exe" />
<dirExists name="$$\..\..\.." />
</and>
</VCROOT>
<!-- VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise -->
<VSINSTALLDIR>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<dirExists name="$$" />
</and>
</VSINSTALLDIR>
<!-- VCVARSALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build -->
<VCVARSALLDIR>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<fileExists name="$$\VC\Auxiliary\Build\vcvarsall.bat" />
<dirExists name="$$" />
</and>
</VCVARSALLDIR>
<!-- KITSROOT = C:\Program Files (x86)\Windows Kits\10 -->
<KITSROOT>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
</or>
<dirExists name="$$" />
</and>
</KITSROOT>
<!-- KITSVER = 10.0.14393 -->
<!-- (note that it doesnt have a trailing .0 in version string) -->
<KITSVER>
<or diagnostic="Could not determine Windows 10 SDK version">
<hklmExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hkcuExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
</or>
</KITSVER>
</locationFinder>
<env
PATH="$VCROOT\bin\HostX64\x64;$VSINSTALLDIR\Common7\IDE\VC\VCPackages;$VSINSTALLDIR\Common7\IDE;$VSINSTALLDIR\Common7\Tools;$KITSROOT\bin\x64;$KITSROOT\bin\$KITSVER.0\x64"
INCLUDE="$VCROOT\include;$VCROOT\atlmfc\include;$KITSROOT\Include\$KITSVER.0\ucrt;$KITSROOT\Include\$KITSVER.0\shared;$KITSROOT\Include\$KITSVER.0\um;$KITSROOT\Include\$KITSVER.0\winrt;$MATLABROOT\extern\include"
LIB="$VCROOT\lib\x64;$VCROOT\atlmfc\lib\x64;$KITSROOT\Lib\$KITSVER.0\ucrt\x64;$KITSROOT\Lib\$KITSVER.0\um\x64;$MATLABROOT\lib\$ARCH"
LIBPATH="$VCROOT\lib\x64;$VCROOT\atlmfc\lib\x64"
/>
</config>
<?xml version="1.0" encoding="UTF-8" ?>
<config
Name="Microsoft Visual C++ 2017 Professional"
ShortName="MSVCPP150"
Manufacturer="Microsoft"
Version="15.0"
Language="C++"
Priority="A"
Location="$VSINSTALLDIR">
<Details
CompilerExecutable="$COMPILER"
CompilerFlags="$COMPFLAGS"
CompilerDefines="$COMPDEFINES"
OptimizationFlags="$OPTIMFLAGS"
DebugFlags="$DEBUGFLAGS"
IncludeFlags="$INCLUDE"
LinkerExecutable="$LINKER"
LinkerFlags="$LINKFLAGS"
LinkerOptimizationFlags="$LINKOPTIMFLAGS"
LinkerDebugFlags="$LINKDEBUGFLAGS"
LinkerLibraries="$LINKLIBS"
CommandLineShell="$VCVARSALLDIR\VCVARSALL.BAT"
CommandLineShellArg="x64"
CompilerDefineFormatter="/D%s"
LinkerLibrarySwitchFormatter="lib%s.lib;%s.lib"
LinkerPathFormatter="/LIBPATH:%s"
LibrarySearchPath="$$LIB;$$LIBPATH;$$PATH;$$INCLUDE;$MATLABROOT\extern\lib\$ARCH\microsoft"
/>
<!-- Switch guide: http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=vs.71).aspx -->
<vars
CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
CMDLINE300="del $OBJ $EXP $LIB $MANIFEST $ILK"
COMPILER="cl"
COMPFLAGS="/Zp8 /GR /W3 /EHs /nologo /MD"
COMPDEFINES="/D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 $MATLABMEX"
MATLABMEX="/DMATLAB_MEX_FILE"
INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\simulink\include&quot;"
OPTIMFLAGS="/O2 /Oy- /DNDEBUG"
DEBUGFLAGS="/Z7"
LINKER="link"
LINKFLAGS="/nologo /manifest"
LINKTYPE="/DLL"
LINKEXPORT="/EXPORT:mexFunction"
LINKLIBS="/LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; 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"
LINKOPTIMFLAGS=""
LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME$LDEXT.pdb&quot;"
OBJEXT=".obj"
LDEXT=".mexw64"
SETENV="set COMPILER=$COMPILER
set COMPFLAGS=/c $COMPFLAGS $COMPDEFINES
set OPTIMFLAGS=$OPTIMFLAGS
set DEBUGFLAGS=$DEBUGFLAGS
set LINKER=$LINKER
set LINKFLAGS=$LINKFLAGS /export:%ENTRYPOINT% $LINKEXPORT $LINKTYPE $LINKLIBS
set LINKDEBUGFLAGS=/debug /PDB:&quot;%OUTDIR%%MEX_NAME%$LDEXT.pdb&quot;
set NAME_OUTPUT=/out:&quot;%OUTDIR%%MEX_NAME%%MEX_EXT%&quot;"
/>
<client>
<engine
LINKLIBS="$LINKLIBS libeng.lib"
LINKEXPORT=""
LDEXT=".exe"
LINKTYPE=""
MATLABMEX=""
/>
<mbuild
CMDLINE100="$COMPILER /c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC /Fo$OBJ"
CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $OBJS $LINKLIBS /out:$EXE"
CMDLINE250="mt -outputresource:$EXE;1 -manifest $MANIFEST"
CMDLINE300="del $MANIFEST &quot;$TEMPNAME.map&quot;"
LINKFLAGS="/nologo /manifest"
LINKLIBS="/MACHINE:AMD64 /LIBPATH:&quot;$MATLABROOT\extern\lib\$ARCH\microsoft&quot; mclmcrrt.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"
INCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
COMPFLAGS="-MD -Zp8 -GR -W3 -EHsc- -Zc:wchar_t- -nologo"
COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE"
OPTIMFLAGS="-O2 -DNDEBUG"
LINKEXPORT=""
LDEXT=".exe"
MATLABMEX=""
LINKTYPE=""
LINKDEBUGFLAGS="/debug /PDB:&quot;$TEMPNAME.pdb&quot;"
/>
<mbuild_com
CMDLINE000="copy &quot;$MATLABROOT\extern\include\$ARCH\mwcomutil.tlb&quot; &quot;$OUTDIR&quot;"
CMDLINE001="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; mwcomtypes.idl"
CMDLINE002="midl /nologo /$ARCH $COMPINCLUDE /D NDEBUG /out &quot;$OUTDIR&quot; &quot;$COMIDL&quot;"
CMDLINE100="$COMPILER $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $COMPINCLUDE $SRC /Fo$OBJ"
CMDLINE150="rc /fo &quot;$RESFILE&quot; &quot;$RCFILE&quot;"
CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
CMDLINE275="&quot;$MATLABROOT\runtime\$ARCH\mwregsvr.exe&quot; $EXE"
CMDLINE300="del $MANIFEST &quot;$OUTDIR\mwcomutil.tlb&quot; &quot;$RESFILE&quot;"
OUTDIR="."
INCLUDE="$INCLUDE -I&quot;$OUTDIR&quot; -I&quot;$MATLABROOT\extern\include\$ARCH&quot;"
COMPFLAGS="/c /GR /W3 /EHsc- -Zc:wchar_t /nologo /MT"
COMPDEFINES="/DMSVC /DIBMPC /D_CRT_SECURE_NO_DEPRECATE /D_SECURE_SCL=0"
COMPINCLUDE="-I&quot;$MATLABROOT\extern\include&quot; -I&quot;$OUTDIR&quot;"
LINKEXPORT="/DLL /def:&quot;$DEFFILE&quot;"
LINKLIBS="/MACHINE:AMD64 $LINKLIBS mclmcrrt.lib &quot;$RESFILE&quot;"
LDEXT=".dll"
USERONLY=""
LINKTYPE=""
MATLABMEX=""
/>
</client>
<locationFinder>
<!-- VCROOT = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017 -->
<VCROOT>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<fileExists name="$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" />
<dirExists name="$$\..\..\.." />
<cmdReturns name="set &quot;vcroot=$$&quot; &amp; for /f &quot;delims= &quot; %a in ('type &quot;$$\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt&quot;') do @call echo %vcroot%\VC\Tools\MSVC\%a" />
<fileExists name="$$\bin\HostX64\x64\cl.exe" />
<dirExists name="$$\..\..\.." />
</and>
</VCROOT>
<!-- VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise -->
<VSINSTALLDIR>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<dirExists name="$$" />
</and>
</VSINSTALLDIR>
<!-- VCVARSALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build -->
<VCVARSALLDIR>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" name="15.0" />
</or>
<fileExists name="$$\VC\Auxiliary\Build\vcvarsall.bat" />
<dirExists name="$$" />
</and>
</VCVARSALLDIR>
<!-- KITSROOT = C:\Program Files (x86)\Windows Kits\10 -->
<KITSROOT>
<and>
<or>
<hklmExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hkcuExists path="SOFTWARE\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" name="KitsRoot10" />
</or>
<dirExists name="$$" />
</and>
</KITSROOT>
<!-- KITSVER = 10.0.14393 -->
<!-- (note that it doesnt have a trailing .0 in version string) -->
<KITSVER>
<or diagnostic="Could not determine Windows 10 SDK version">
<hklmExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hkcuExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hklmExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
<hkcuExists path="SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" name="ProductVersion" />
</or>
</KITSVER>
</locationFinder>
<env
PATH="$VCROOT\bin\HostX64\x64;$VSINSTALLDIR\Common7\IDE\VC\VCPackages;$VSINSTALLDIR\Common7\IDE;$VSINSTALLDIR\Common7\Tools;$KITSROOT\bin\x64;$KITSROOT\bin\$KITSVER.0\x64"
INCLUDE="$VCROOT\include;$VCROOT\atlmfc\include;$KITSROOT\Include\$KITSVER.0\ucrt;$KITSROOT\Include\$KITSVER.0\shared;$KITSROOT\Include\$KITSVER.0\um;$KITSROOT\Include\$KITSVER.0\winrt;$MATLABROOT\extern\include"
LIB="$VCROOT\lib\x64;$VCROOT\atlmfc\lib\x64;$KITSROOT\Lib\$KITSVER.0\ucrt\x64;$KITSROOT\Lib\$KITSVER.0\um\x64;$MATLABROOT\lib\$ARCH"
LIBPATH="$VCROOT\lib\x64;$VCROOT\atlmfc\lib\x64"
/>
</config>
@andreluizgit
Copy link

andreluizgit commented Sep 19, 2017

Would you have the "nvcc_msvcpp2017.xml" because only exist the nvcc_msvcpp2015.xml ??

@ZHUIA
Copy link

ZHUIA commented Jan 28, 2018

I tried this with MATLAB 2017b it didnt work. mex -setup -v is unable to find VS 2017 .. any suggestions
image

@ZM-J
Copy link

ZM-J commented Jul 4, 2018

Unfortunately, this did not work on my Matlab 2016a. Perhaps I had better upgrade my Matlab first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment