Unable to create mex function for simulink model

76 Ansichten (letzte 30 Tage)
Joydeep
Joydeep am 8 Jun. 2023
Beantwortet: Vignesh am 2 Jan. 2024
Hi,
Whenever I'm tryng to run (Ctrl+D) my simulink model it is giving the error:
Making simulation target vce_driveline_sfun. 'nmake' is not recognized as an internal or external command, operable program or batch file.
Component:Make | Category:Make error
Unable to create mex function 'vce_driveline_sfun.lib' required for simulation.
Component:Simulink | Category:Model error
I found a workaround for this issue:
"try this solution :- setting requires in Configuration Parameters > Simulation Target > Adavanced Parameters > Enable Genetared typedefs for imported bus and enumeration type."
By doing the above, I'm able to Run the model, but not able to save the model with this setting.
So immediatley after when I'm trying to generate code for the model it is returning error:
>> GenCode(options,{'DtCtrl'});
### Build procedure for DtCtrl aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
==================================================================
DtCtrl Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 2.467s
ERROR: Error using tlc_c
Unable to create mex function 'vce_driveline_sfun.lib' required for simulation.
Error in coder.internal.ModelBuilder>i_buildProcedure (line 706)
buildResult = tlc_c(hCodegenMgr,...
Error in coder.internal.ModelBuilder.make_rtw (line 119)
[buildResult, mainObjFolder] = i_buildProcedure...
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
Error in sl_feval
Error in slbuild
Error in slbuild
Error in rtwbuild
Error in CreateCodeAllModels (line 90)
rtwbuild(model);
Error in SimulinkPCG (line 146)
[CodeGenSt,models] = CreateCodeAllModels(appCfg,PCG,SysList,DdPresent);
Error in GenCode (line 281)
CodeGenSt = SimulinkPCG(appConfig,SysList); % Call the master simulinkPCG - Show complete stack trace
Build Completed
Completed SimulinkPCG
------------------------
I know its related to some compiler issue.
Is there a way to fix it ?
Thanks!

Antworten (1)

Vignesh
Vignesh am 2 Jan. 2024
Hi Joydeep,
The error message you see when you run the model could be due to the system PATH environment variables in MATLAB. I suggest you check if the Visual Studio path is set properly. A model would be helpful for further debugging, if the issue is still persistent.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by