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

20 Ansichten (letzte 30 Tage)
Antimo
Antimo am 20 Mär. 2025
Kommentiert: Pratyush Swain am 28 Mär. 2025
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 Kommentar
Pratyush Swain
Pratyush Swain am 28 Mär. 2025
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by