Why do I get an "Options file is invalid" error when I try to build an S-Function in MATLAB R2016b?

3 visualizzazioni (ultimi 30 giorni)
I am trying to use the S-function target to generate an S-function from my subsystem. However, I encounter the following build error:
### Compiling foo_sf.c
C:\PROGRA~1\MATLAB\R2016b\bin\mex -c -v -win64 OPTIMFLAGS="/Od /Oy-" -f
"C:\Users\johndoe\AppData\Roaming\MathWorks\MATLAB\R2016b\mex_C_win64.xml" foo_sf.c
Error: An options file for MEX was found, but the value for 'COMPILER'
was not set. This could mean that the value is not specified
within the options file, or it could mean that there is a
syntax error within the file.
C:\PROGRA~1\MATLAB\R2016b\BIN\MEX.PL: Error: Options file is invalid.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 17 Mag 2023
Modificato: MathWorks Support Team il 17 Mag 2023
The above error message indicates that the build process invoked "mex.pl" (Perl script from an obsolete workflow), instead of "mex.bat". This can happen of the PATHEXT environment variable has the .PL extension listed before the .BAT extension. In this case, the output from the "getenv('PATHEXT')" command may look as given below:
>> getenv('PATHEXT')
ans =
PL;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
In order for the build process to succeed, please overwrite the PATHEXT environment variable for your MATLAB session so that the .PL extension is not included (or placed somewhere behind .BAT), by using the following command:
>> setenv('PATHEXT','COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC');
In order to automate the execution of the above command at the start of every MATLAB session, add it to a "startup.m" file as shown in the following documentation page:

Più risposte (0)

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Prodotti


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by