Code generated : error C2027: use of undefined type 'Block'

조회 수: 4 (최근 30일)
Antimo
Antimo 2025년 3월 20일
댓글: Pratyush Swain 2025년 3월 28일
Good afternoon.
I was attempting to create an executable from my model using Embedded Coder. However, when building the code for certain blocks within a subsystem, I encountered an error related to the usage of an undefined type.
The "undefined type" for these blocks is defined in a specific .h file. Both the .cpp and .h files are generated according to the .tlc file.
I am not an expert in code generation. The blocks experiencing this issue are generated using C++ code and a tool employed by my company for converting C++ to MATLAB.
For each problematic blocks, the content of the build folder included header files and dependencies:
So the undefined block is actually decleared and defined, in the .h file associated to it.
Do I need to set some additional option for the building?
  댓글 수: 1
Pratyush Swain
Pratyush Swain 2025년 3월 28일
Hi Antimo,
From your description it seems you have external dependencies, that you want to add for code generation.Currently your external definition is available in .h file. I would recommend to leverage Model Configuration Parameters for code generation custom code: https://www.mathworks.com/help/rtw/ref/code-generation-pane-custom-code.html
If you are using C++ based S functions in your model, you can also refer to https://www.mathworks.com/help/rtw/code-generation-for-custom-blocks.html
Hope this helps.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by