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

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 commentaire

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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange

Question posée :

le 20 Mar 2025

Commenté :

le 28 Mar 2025

Community Treasure Hunt

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

Start Hunting!

Translated by