Cannot open source file "Mfx.h", #include "Mfx.h"

When generating code from a model that uses a minmax block, MATLAB/RTW throws out the following warning.
The model is a SW Component on autosar.tlc target, Matlab 2013b
Warning: The following error occurred while attempting to run the preprocessor to find the minimum needed set of include files:
While parsing the source file 'C:\repository\trunk\src\MySwc\MySwc_autosar_rtw\stub\Rte_MySwc_calib.c' the following error occurred
C:\repository\trunk\src\MySwc\MySwc_autosar_rtw\MySwc.h:22: cannot open source file "Mfx.h"
#include "Mfx.h"
^
Reverting to full header search.
Looking to the generated code I see that there is a library function being used Mfx_Min_u32() to get the minimum between two signals corresponding to the minmax block inside the model.
Anyone knows why this happens? How can I avoid this and get rid of this Mfx_ library?
Thanks.

 采纳的回答

This is happening because in Configuration Parameters > Code Generation > Interface > Code replacement library is set to AUTOSAR 4.0
Changing it to C89/C90 (ANSI) fixes the issue in R2013b.
With this change, the #include is not there and a basic less than equal to check in included in the generated C code.
The issue has been resolved in latest release i.e., R2014b.
Thanks, Sandip Kumar, MathWorks

2 个评论

Recently I have faced this error. The model is a SW Component on autosar.tlc target, Matlab 2015b. The code is generated with Mfx_ library like below example Mfx_Sub_u16u16_u16(rbp_par_get_hmi_pass_Zone11MiddleDstMin_U16, rbp_par_get_hmi_pass_Zone11CutOffHysteresisMin_u16). While compiling the code getting error ""fatal error #5: could not open source file "Mfx.h" ""
Changine the compiler from Autosar to the alternative (GNU) worked in version 2021b.

请先登录,再进行评论。

更多回答(1 个)

Do you know of a way to halt this warning and make it disappear? I am sure it is possible in the options of the model, not sure which one though. Thanks

类别

在 帮助中心 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by