Unable to create mex function 'XX_Simulinkfunction_sfun.mexw64' required for simulation.
94 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
MIN U SHIN
2020 年 12 月 28 日
no, I'm stucked in same problem.
Unable to create mex function 'AutomatedParkingValet_sfun.mexw64' required for simulation.
How can I solve this?
回答 (3 件)
Jagtendra Kumar
2019 年 9 月 6 日
編集済み: Jagtendra Kumar
2019 年 9 月 6 日
try this solution :- setting requires in Configuration Parameters > Simulation Target > Adavanced Parameters > Enable Genetared typedefs for imported bus and enumeration type.
2 件のコメント
weyl chen
2024 年 8 月 19 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Configure and View Diagnostics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!