Having problem in MatConvNet when compiling
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Suryadiputra Liawatimena
le 31 Juil 2018
Modifié(e) : Suryadiputra Liawatimena
le 31 Juil 2018
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.
Suryadiputra Liawatimena
le 31 Juil 2018
Modifié(e) : Suryadiputra Liawatimena
le 31 Juil 2018

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.
Réponses (1)
Walter Roberson
le 26 Jan 2017
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 commentaires
Steven
le 25 Juin 2025
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.
Walter Roberson
le 25 Juin 2025
Note: in the years since I posted the above, support was largely added for non-professional editions of later VS compilers.
Voir également
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!