Matconvnet error cl.exe not found

2019-05-27 12:43发布

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

4条回答
女痞
2楼-- · 2019-05-27 12:49

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

查看更多
ゆ 、 Hurt°
3楼-- · 2019-05-27 12:50

cl.exe is a C++ compiler.

This message means that the program cannot find this file on your computer (either because it is actually not there, or because you did not indicate its location.)

If you actually have a C++ compiler and work with Windows, go to the properties of your PC -> advanced settings -> Environment Variables (Sorry if the names are not accurate, my computer is in French but should be something similar...). Here you will have a field called PATH with most probably some paths already set. Modify it by adding the path of you C++ compiler (the folder containing cl.exe) and reboot your computer (your change is not taken into account otherwise).

I do not know how to do for other OS...

Otherwise, you need to download a C++ compiler. Visual Studio is free and has one.

查看更多
干净又极端
4楼-- · 2019-05-27 12:57

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.

查看更多
做自己的国王
5楼-- · 2019-05-27 13:06

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)

查看更多
登录 后发表回答