Code generated : error C2027: use of undefined type 'Block'
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Pratyush Swain
el 28 de Mzo. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!