Matconvnet error cl.exe not found

12,877

Solution 1

install visual studio community edition ( it's the free edition ) (minwg compiler will not work) go to C:\Program Files (x86)\Microsoft Visual Studio search for cl.exe take the one appropriate for your computer architecture and copy it to the folder containing the matconvnet installation run mex -setup c++ and set it to visual studio and you're good to go

Solution 2

Matlab accepts Professional Version of Visual Studio Compiler as I found out in one of the posts on MatLab forums.

The following is an easier solution,

addpath(fullfile('C:', 'Program Files (x86)', 'Microsoft Visual Studio', '2017', 'Professional', 'VC', 'Tools', 'MSVC', '14.16.27023', 'bin', 'Hostx64', 'x64'));

Matlab Post for reference: https://se.mathworks.com/matlabcentral/answers/271382-mex-won-t-recognize-microsoft-visual-c-compilers

Solution 3

Unfortunately MatConvNet does not support MinGW compiler in the current version. On Windows, you need to install Microsoft Visual Studio. Nowdays you can download the community edition for free, e.g. here.

One of the reasons why MatConvNet does not support MinGW is that on windows it uses the GDI+ library to speed up reading image files. You can try to compile it using: vl_compilenn('EnableImreadJpeg', false)

Solution 4

I have added the directory with cl.exe to my system PATH variable (you need to restart Matlab after that operation) and the compilation succeeded. The check_clpath() function was unable to find proper location of cl.exe, because it was trying to find executable in directory which does not exsist:

cl_path =

'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\bin\amd64'

after adding the cl.exe dir to PATH variable, in my case:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

the compilation succeeded.

Solution 5

This worked for me

  1. install community visual studio 2019 professional from https://visualstudio.microsoft.com/es/downloads/
  2. move to the directory where the installer placed visual studio. In my case C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
  3. locate the cl.exe appropriate to your host and target architecture (there are four combinations x86/x64). In my case x64/x64 resulted in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64 place the path in the environmental variable in your system
  4. within matlab, move to CF2-master\external\matconvnet\matlab and execute vl_compilenn
Share:
12,877
user7029552
Author by

user7029552

Updated on June 27, 2022

Comments

  • user7029552
    user7029552 about 2 years

    I have installed MatConvNet from VLFeat and I am trying to compile it. But as I am trying to run vl_compilenn it shows the following error:

    vl_compilenn
    Warning: CL.EXE not found in PATH. Trying to guess out of mex setup. 
    > In vl_compilenn>check_clpath (line 580)
      In vl_compilenn (line 413) 
    'cl.exe' is not recognized as an internal or external command, 
    operable program or batch file. 
    Error using vl_compilenn>check_clpath (line 591)
    Unable to find cl.exe
    
    Error in vl_compilenn (line 413)
        check_clpath(); % check whether cl.exe in path