Having problem in MatConvNet when compiling

Using R2016a in 64-bit Win7, and installed Microsoft Visual Studio 2015.
I was trying to install and compile MatConvNet library for CPU but I had some problem on compiling step. I follow the instructions in this website: http://www.vlfeat.org/matconvnet/install/
So the first step is Make sure that MATLAB is configure to use your compiler:
I tried "mex -setup" in command window and got MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
When I tried to conduct second step
> cd < MatConvNet >
> addpath matlab
> vl_compilenn
I got the error: '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
Error in run (line 96) evalin('caller', [script ';']);
I have tried: add the path of visual studio cl.exe or copy the cl.exe file to MatConvNet download file
Anyone knows how to solve the problem?
Many thanks
Mei

4 Comments

I have the same problem, did you solve it?
I have the same problem!! did you solve it??
I am using 2018a, windows 7 64 bit, student version. Installed Microsoft Visual 2017, MinGW-w64 5.3.0 at E:\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4-rev0
I can set compiler to MinGW C++
>> mex -setup:C:\Users\user\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C++_win64.xml C++
I add cl.exe location (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\Hostx64\x64) to my PATH I try to run vl_compilenn, the error message: (error-vl-compile.txt as attachment for more complete errors).
Please help to compile and setup vl. Thanks in advance.
I try to open E:\matconvnet\matconvnet-latest\matconvnet-1.0-beta25\matconvnet.sln using Microsoft Visual Studio 2017. Press F7 to build it. The error message as in the picture.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: matlab -nodesktop -nosplash -wait -r "diary('cclog.txt');try cc; catch e; disp('CC failed'); diary off ; exit(1) ; end ; disp('CC succeeded'); diary off ; exit(0);"
please help. thanks.

Sign in to comment.

Answers (1)

If you look at the Supported Compiler chart https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016a_SupportedCompilers.pdf you might notice that MingW is only supported for some kinds of compiling. And of course third-party toolboxes might have been coded in such a way that they do expect to use Visual Studio to compile.
The Community and Express versions of Visual Studios have not been supported compilers since around R2012a -- only the Professional (and probably Ultimate) versions have been supported.
As you have VS, you could try using mex -setup to configure VS. I am not convinced it will work, though: when I have seen the message about cl.exe before, it has typically had to do with a difference in executable name and configuration between the Professional and Express versions.

3 Comments

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).
Otherwise, you need to download a C++ compiler. Visual Studio is free and has one.
I had a similar problem with locating the cl.exe . What worked for me is in the Visual Studio tab in my start menu (using windows here) there is a command prompt tool called 'x64 Native Tools Command Prompt' . If you run commands or run the program from that shell it will somehow give access to that compiler.
I'm not sure why it works as I'm not knowledgable about c++ but I just need it to work for a project and it helped.
Note: in the years since I posted the above, support was largely added for non-professional editions of later VS compilers.

Sign in to comment.

Categories

Asked:

on 9 Aug 2016

Commented:

on 25 Jun 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!