필터 지우기
필터 지우기

How to force use <stdbool.h> in embedded coder? - MISRA violation

조회 수: 3 (최근 30일)
Giuseppe Narracci
Giuseppe Narracci 2022년 2월 8일
답변: Benjamin Thompson 2022년 2월 8일
Hello,
I have a model that I converted in C code with embedded coder.
I checked MISRA violations on that code and cppcheck returned me 14.4 violation:
The controlling expression of an if statement and the controlling expression of an iteration-statement shall have essentially Boolean type.
The problem is that in if-else statements, the generated C code uses an unsigned char zcEvent_0
(that's why I have this violation).
Is there a possibility to force Embedded Coder to use <stdbool.h> ?

답변 (1개)

Benjamin Thompson
Benjamin Thompson 2022년 2월 8일
In the Model Settings, Code Generation, Custom Code section, try adding the #include statement. You might have to try multiple places like "Header file", "Source file", etc. to see what works best for your application.

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by