Error when using vl_compilenn: cannot found cl.exe in path

조회 수: 107(최근 30일)
I got errors when running vl_compilenn as follows:
>> vl_compilenn
Warning: CL.EXE not found in PATH. Trying to guess out of mex setup.
> In vl_compilenn>check_clpath (line 566) In vl_compilenn (line 400) 'cl.exe' is not recognized as an internal or external command, operable program or batch file. Error using vl_compilenn>check_clpath (line 577) Unable to find cl.exe
Error in vl_compilenn (line 400) check_clpath(); % check whether cl.exe in path
I use MATLAB2015b on Windows 10, Microsoft Visual C++ 2013 Professional (C) for C language compilation, and Visual Studio 2013.
Also, I tried to set the Path and Environment Variables for Command-Line Builds as following command: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>vcvarsall x86_amd64 on the VS2012 x64 Cross Tools Command Prompt.
But, it cannot fix my problem. Could you please give me solution for this error.
Thank you for your help.
  댓글 수: 3

댓글을 달려면 로그인하십시오.


Major_He 2017년 5월 9일
I have just solved this problem by reading this webpage:
I use Matlab R2016b on windows 10, Visual Studio 2017 Community. Visual Studio 2017 works well in my computer when compiling C/C++ programs, and I just add a new path (the folder containing cl.exe in Visual Studio installed path) to computer's Environment Variables. Then, this problem solved.
  댓글 수: 3
Andrew Mao
Andrew Mao 2018년 9월 26일
편집: Walter Roberson 2018년 9월 26일
Thank you so much! This has been terribly frustrating. If anyone happens to get a different error after this, go here and follow the most liked response:

댓글을 달려면 로그인하십시오.

Shaode Yu
Shaode Yu 2019년 4월 12일
% (1) Unable to find cl.exe
% (a) Adding the directory with cl.exe to the system PATH variable
% (b) Restart MATLAB
% (c) Compile (1) mex -setup C++ (2) vl_compilenn
% Reason: The check_clpath() needs to know the proper location cl.exe
  댓글 수: 2
Shaode Yu
Shaode Yu 2019년 4월 12일
It requires Visual Studio compiler. In particular, MatConvNet requires Visual Studio 2015 and later. It is a prerequisite.
In addition, install the software Everything ( and you can find all files on your computer.

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2017년 5월 9일
Typically this error occurs when you have a Community edition or Express edition of Visual Studio installed but your MATLAB version only expects the corresponding Professional version.
  댓글 수: 1
Jon Slow
Jon Slow 2017년 10월 22일
So what do I do? get a professional trial?

댓글을 달려면 로그인하십시오.

Ayshath Afra
Ayshath Afra 2020년 3월 10일
Error in vl_compilenn (line 417)
cl_path = fileparts(check_clpath()); % check whether cl.exe in path
anyone pls help to solve this error in matlab
this error is showing while compiling matconvnet.
  댓글 수: 7
Walter Roberson
Walter Roberson 2020년 3월 11일
It will never be possible to compile that program with MinGW. You should give up trying.
Either install Visual Studios 2017 Community Edition, or else give up on using the software.

댓글을 달려면 로그인하십시오.


Find more on Write C Functions Callable from MATLAB (MEX Files) 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!

Translated by