main.c:405: error: undefined reference to 'InitInfAndNaN', Getting this error when I'm building a .mdl Simulink Module.

조회 수: 6 (최근 30일)
Im getting the above error when I'm building the .mdl modules in 2024a or 2024b but not getting when I'm using previous versions of 2024a. And also I'm not getting the error when I'm using .slx module for any version of matlab.

답변 (1개)

Hitesh
Hitesh 2025년 5월 15일
편집: Hitesh 2025년 5월 15일
Hi Veera,
The "rt_InitInfAndNaN" function is a support routine inserted automatically when your model may involve special floating-point values, such as:
  • NaN (Not a Number)
  • Inf (Infinity)
Its purpose is to initialize platform-specific representations of these values so they can be used reliably in the generated code. You need to remove this function, you must ensure that your model does not require non-finite values.
You can do this by changing the following code generation settings:
  1. Go to Model Configuration Parameters
  2. Under Code Generation > System target file : Ensure it is set to 'ert.tlc'.
  3. Go to Code Generation > Interface tab: Set "Support non-finite numbers" to OFF and Set "MAT-file logging" to OFF if not needed.
Disabling support for non-finite numbers tells Embedded Coder that your application will not use NaN, Inf, or -Inf, allowing it to omit rt_InitInfAndNaN from the generated code.
For more information regarding "rt_InitInfAndNaN", kindly refer to the following MATLAB documentation:

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by