Unable to create mex function 'XX_Simulinkfunction_sfun.mexw64' required for simulation.
131 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to call custom c code in my stateflow and got below error
Making simulation target "XX_Simulinkfunction_sfun", ... Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option '-' Stop.
Component:Make | Category:Make error
Unable to create mex function 'XX_Simulinkfunction_sfun.mexw64' required for simulation.
example.c
#include "example.h"
double busactive(double u1, double u2)
{
double retval;
retval = u1 + u2;
return (retval);
}
example.h
#define TRUE 1
#define FALSE 0
#define MAYBE 2
double busactive(double, double);
added #include "example.h" in simulation target Header file section and example.c is source file section.
using 2018a matlab and MEX configured to use 'Microsoft Visual C++ 2017 (C)' for C language compilation.
Could anyone help me solving this issue.
2 Kommentare
MIN U SHIN
am 28 Dez. 2020
no, I'm stucked in same problem.
Unable to create mex function 'AutomatedParkingValet_sfun.mexw64' required for simulation.
How can I solve this?
Antworten (3)
Jagtendra Kumar
am 6 Sep. 2019
Bearbeitet: Jagtendra Kumar
am 6 Sep. 2019
try this solution :- setting requires in Configuration Parameters > Simulation Target > Adavanced Parameters > Enable Genetared typedefs for imported bus and enumeration type.
2 Kommentare
weyl chen
am 19 Aug. 2024 um 8:18
It's trouble for me. But I find this cause. "Unable to create mex function 'VLC_APA_sfun.mexw64' required for simulation."
I am find last. because The Enum Data type is error. I define the enum name is "Astate" 0-state1 1-state2 2-state3.
in chart if you defin the same name of inport and enum, this may error of "Unable to create mex function 'VLC_APA_sfun.mexw64' required for simulation."
e.g.
if (Astate == Astate.state1) {aa = 0;}
change this
if (Astate_in == Astate.state1) {aa = 0;} the problem is gone.
=================================================================================
问题:
“由于枚举数据类型错误,导致无法为仿真创建所需的 'VLC_APA_sfun.mexw64' MEX 函数。”
解决方案:
“我在状态图中定义了一个名为 'Astate' 的枚举类型,其值为 0-state1,1-state2,2-state3。如果在状态图中定义的枚举名称与输入端口名称相同,就可能出现 'VLC_APA_sfun.mexw64' MEX 函数创建失败的错误。例如,如果写成:
```c
if (Astate == Astate.state1) { aa = 0; }
```
会出现问题。但改成:
```c
if (Astate_in == Astate.state1) { aa = 0; }
```
问题就解决了。”
您需要确保在条件语句中使用的枚举变量名与输入端口的名称区分开来,避免命名冲突。
1 Kommentar
Siehe auch
Kategorien
Mehr zu Web Services finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!