
How do I include multiple C library headers with the same include guards in Simulink?
I have C code that describes the functionality of two systems. The codebase contains files with identical names but different content, and they also share the same header include guards. I would like to use these two systems in the same Simulink model. For example:
When I try to separate the files using Simulink Libraries, I get syntax errors while building the model.
Error(s) encountered while building simulation target MEX-file for model 'two_blocks'.
Caused by:
Microsoft (R) Program Maintenance Utility Version 14.37.32825.0
Copyright (C) Microsoft Corporation. All rights reserved.
### Compiling two_blocks_cgxe.c
cl.exe /c /Zp8 /GR /w /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMX_COMPAT_64 /DMATLAB_MEXCMD_RELEASE=R2018a /DMATLAB_MEX_FILE /nologo /MD /I "E:\ML_MATLAB64\R2023b\extern\include" /I "E:\ML_MATLAB64\R2023b\simulink\include" /I "E:\ML_MATLAB64\R2023b\rtw\c\src" /I "E:\ml_workspace\c_function_article\slprj\_cgxe\two_blocks\src" /I "E:\ml_workspace\c_function_article" /I "E:\ML_WORKSPACE\c_function_article\slprj\_cprj" /I "E:\ML_WORKSPACE\c_function_article\slprj\_cgxe\two_blocks\src" /I "E:\ML_WORKSPACE\c_function_article" /I "E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC" /I "E:\ML_WORKSPACE\c_function_article\slprj\_slcc\rzKA0zoVhTuLQia7fzdvOF" /I "E:\ml_workspace\c_function_article\block_1" /I "E:\ml_workspace\c_function_article\block_2" "two_blocks_cgxe.c"
two_blocks_cgxe.c
E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC\slcc_interface_OHf1uuaSWAsj9L9zbRSKeC.h(17): error C2146: syntax error: missing ')' before identifier 'inp'
E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC\slcc_interface_OHf1uuaSWAsj9L9zbRSKeC.h(17): error C2061: syntax error: identifier 'inp'
E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC\slcc_interface_OHf1uuaSWAsj9L9zbRSKeC.h(17): error C2059: syntax error: ';'
E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC\slcc_interface_OHf1uuaSWAsj9L9zbRSKeC.h(17): error C2059: syntax error: ')'
NMAKE : fatal error U1077: 'cl.exe /c /Zp8 /GR /w /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMX_COMPAT_64 /DMATLAB_MEXCMD_RELEASE=R2018a /DMATLAB_MEX_FILE /nologo /MD /I "E:\ML_MATLAB64\R2023b\extern\include" /I "E:\ML_MATLAB64\R2023b\simulink\include" /I "E:\ML_MATLAB64\R2023b\rtw\c\src" /I "E:\ml_workspace\c_function_article\slprj\_cgxe\two_blocks\src" /I "E:\ml_workspace\c_function_article" /I "E:\ML_WORKSPACE\c_function_article\slprj\_cprj" /I "E:\ML_WORKSPACE\c_function_article\slprj\_cgxe\two_blocks\src" /I "E:\ML_WORKSPACE\c_function_article" /I "E:\ML_WORKSPACE\c_function_article\slprj\_slcc\OHf1uuaSWAsj9L9zbRSKeC" /I "E:\ML_WORKSPACE\c_function_article\slprj\_slcc\rzKA0zoVhTuLQia7fzdvOF" /I "E:\ml_workspace\c_function_article\block_1" /I "E:\ml_workspace\c_function_article\block_2" "two_blocks_cgxe.c"' : return code '0x2'
Stop.
Is there a way to include both headers in the source code for the same model?
Respuesta aceptada

0 comentarios
Más respuestas (0)
Ver también
Categorías
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!