• Welcome to Rotar E@rth!
  • Feel free to look around and comment~
  • Tin - for a better fantasy life!
  • TinTimer - for an even better fantasy life!

MatConvNet with Visual Studio 2015.3 Toolset and MATLAB R2017a

Programming Rotar 2211 Views 0 Comment


After a recent re-install of Windows on my laptop, I decided to install the latest version of the software packages that I frequently use. This include MATLAB R2017a ,Visual Studio 2017 Enterprise and MatConvNet.

However, it turns out that MATLAB R2017a does not support using VS2017 out of the box (patch required). What’s worse is that CUDA Toolkit 8.0 also doesn’t support VS2017 yet.

In order to use MatConvNet for my research, I had to install VS2015.3 Toolset (optional component of VS2017) and configure MATLAB R2017a to use it.


System Environment

OSWindows 10 Home 1703 Build 15063.0
CUDA Toolkit8.0.61
Visual Studio2017 Enterprise with 2015.3 Toolset

Required Files

R2016b_Patch_for_VS2015.3_Toolset (Not tested)

R2017a_Patch_for_VS2015.3_Toolset (Tested)

Download the zip file for your MATLAB version. Then extract the content of the archive to your MATLAB installation folder.



The files above are modified from msvc2015.xml and msvcpp2015.xml within ‘MATLAB\R201XX\bin\win64\mexopts’ folder with reference to the patch for VS2017.

FieldOriginal ValueNew Value
NameMicrosoft Visual C++ 2015 ProfessionalMicrosoft Visual C++ 2015.3 Toolset
VCROOT -> pathVS7VC7
VCROOT -> fileExists -> name$$\VC\bin\amd64\cl.exe$$\bin\amd64\cl.exe
SDKROOT -> pathv8.1v10.0
VCVARSALLDIR -> fileExists -> name$$\VC\vcvarsall.bat$$\vcvarsall.bat
SDKVERSIONN/A(Section copied from VS2017 patch)
env -> PATH$VCROOT\Bin\amd64;
env -> LIB$VCROOT\Lib\amd64;



First, configure MATLAB to use the VS2015.3 Toolset by using command:
mex -setup  and  mex -setup C++
and clicking on the ‘Microsoft Visual C++ 2015.3 Toolset‘ option.

Then change the current directory to your MatConvNet folder (matconvnet\matlab) and use vl_compilenn  to compile. In my case, the command is as follows:

Details about parameters for vl_compilenn  can be found here. After the compilation finished, copy cudnn64_5.dll to ‘matconvnet\matlab\mex’ and you’re good to go.

Side Notes

  1. It is extremely useful to call mex  in verbose mode so that you know how the variables are set:
    mex -v -setup:'C:\Program Files\MATLAB\R2017a\bin\win64\mexopts\YOURCONFIGURE.xml'
  2. In the locationFinder part,   $$ means the current variable found by proceeding commands.
    For example, the $$ in fileExists  in <VCROOT>  represents %VCROOT  itself as found by the hkXXExists commands.

本网站采用BY-NC-SA协议进行授权 , 转载请注明MatConvNet with Visual Studio 2015.3 Toolset and MATLAB R2017a
Like (0)

表情 贴图 加粗 删除线 居中 斜体 签到


  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址