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

5 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2024-3-29
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:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by