loadlibrary: 'cl' is not recognized....
15 views (last 30 days)
Show older comments
I'm trying to load a *.dll that was compiled with Microsoft Visual C++ 2008. I've downloaded & installed Microsoft Visual C++ 2008 Express and selected it wit mex setup. When I run loadlibrary, I get the error: "'cl' is not recognized as an internal or external command, operable program or batch file."
>> mex -setup Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler: [1] Microsoft Visual C++ 2010 in c:\Program Files (x86)\Microsoft Visual Studio 10.0 [2] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
*************************************************************************** Error: Could not find the 64-bit compiler. This may indicate that the "X64 Compilers and Tools" or the Microsoft Windows Software Development Kit (SDK) is not installed. To build 64-bit MEX-files Microsoft Visual C++ 2008 Express Edition requires that these two packages are installed properly. ***************************************************************************
Trying to update options file: C:\Users\traker\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2010b\bin\win64\mexopts\msvc90freeopts.bat
Done . . .
************************************************************************ Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9 Building with the -largeArrayDims option enables the new API. ************************************************************************
>> loadlibrary(Dll,Hfile) ??? Error using ==> loadlibrary at 365 Failed to preprocess the input file. Output from preprocessor is:'cl' is not recognized as an internal or external command, operable program or batch file.
0 Comments
Answers (2)
Walter Roberson
on 2 Feb 2012
Was the dll compiled for 32 bit or for 64 bit?
You are using 64 bit MATLAB, which can only compile 64 bit interfaces and only load 64 bit dll's. In order to work it needs the SDK 7.1 installed (which you do not have installed it appears.)
If you need to load a 32 bit dll, then you need to install the 32 bit version of MATLAB and use that; you will need to mex -setup while you are running that as it needs to build a 32-bit specific options file.
0 Comments
Troy Raker
on 3 Feb 2012
4 Comments
Alfredo
on 12 Mar 2013
I got the same error, the problem was that the path to cl.exe was not in PATH environment variable for 64-bit cl.exe. In another case, this path was added "after" the path to the 32-bit version of cl.exe, so the system would find the 32-bit version first, and I would get some platform incompatibility error. So make sure you add the correct version path to PATH. For 64-bit: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64
See Also
Categories
Find more on Troubleshooting in MATLAB Compiler SDK 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!