Why do I receive errors using -f with MEX when trying to compile using Intel Fortran or MS Platform SDK with MATLAB 7.2 (R2006a)?

1 view (last 30 days)
On a 64-bit Windows machine I receive errors when using the -f flag to specify an options file for either the Intel Fortran compiler or the MS Platform SDK compiler.
For example, if I execute
mex -f intelf90opts.bat yprimef.F yprimefg.F
I receive the following errors
'link' is not recognized as an internal or external command,
operable program or batch file.
ERROR: D:\Applications\MATLAB\BIN\MEX.PL: Error: Link of 'yprimef.mexw64' failed.
??? Error using ==> mex
Unable to complete successfully
mex -f mspsdkopts.bat yprime.c
ERROR: D:\Applications\MATLAB\BIN\MEX.PL: Error: Compile of 'yprime.c' failed.
??? Error using ==> mex
Unable to complete successfully
No error occurs if I execute "mex -setup" and then compile without -f, or if I use the MSVC 8.0 compiler.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Feb 2023
Edited: MathWorks Support Team on 18 Apr 2023
This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
The ability to fully configure the Intel Fortran and Microsoft Platform SDK using "mex -f" is not available in MATLAB. To work around this issue, there are several options:
Workaround 1: Use mex -setup
If you are building a MEX-file, you might be able to work around this issue by executing
mex -setup
then choosing the appropriate compiler, and then using mex without the -f option to build the MEX-file.
Workaround 2: Define the Environment Variable
If you are building an Engine or MAT application, or if mex -setup fails to resolve the issue, you can define the appropriate environment variable:
If you are using Intel Visual Fortran on MATLAB for Windows (32-bit), define VS71COMNTOOLS.
If you are using Intel Visual Fortran or Microsoft Platform SDK on MATLAB for Windows x64, define MSSdk.
If you are using Microsoft Visual C++ 2005 Express Edition, you will also need install Platform SDK and define MSSdk as an environment variable.
The value for this variable should be the path of the Platform SDK directory. For example
MSSdk=C:\Program Files\Microsoft Platform SDK
The Description section describes the appropriate value for each environment variable.
To define an environment variable:
Right-click My Computer and click Properties on the shortcut menu.
Click the Advanced tab.
Click Environment Variables.
Beneath the System variables list, click New.
Enter the appropriate name and value for the environment variable and click OK.
Click OK in the Environment Variables dialog box.
Click OK in the System Properties dialog box.
Workaround 3: Use a Different Compiler
You might be able to work around the issue by using another supported compiler.
You can find a list of supported compilers here:
The details regarding environment variables in for Microsoft compiler SDK setup is mentioned under External Interface/API, coming under R2007b release notes, in the below link:

More Answers (0)

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!