フィルターのクリア

Header file is not compiling

2 ビュー (過去 30 日間)
Carl-Jakob Ulmer
Carl-Jakob Ulmer 2015 年 6 月 16 日
編集済み: Andrew Schenk 2015 年 6 月 17 日
Hello,
in my data dictionary I defined an enumeration with Data Scope "Imported" and a header file. In the header file there are a bunch of enumerations/structs defined, not only the one used in Simulink (because it's importet from other source code). The header file is stated in the configuration in "Simulation Target" -> "Custom Code". When I want to compile I get an error, because in the header file there are enumerations/structs which Simulink does not know. But I want Simulink to search only for the enumerations I have specified in my data dictionary and not care about other stuff in the header file. Is there a way how to handle that?
Thank you

採用された回答

Andrew Schenk
Andrew Schenk 2015 年 6 月 17 日
編集済み: Andrew Schenk 2015 年 6 月 17 日
This is more of a limitation of normal C coding - if a header file is included, all of the contents of the header file must be defined.
There are a few workarounds:
  1. Create a separate header file (data_dictionary_enums.h for example) with only the enumerations needed by the Data Dictionary, and then add #include "data_dictionary_enums.h" to the main header file.
  2. Add a preprocessor macro to the header file such that the rest of the header file is only included when a specific define is set.
  3. Add the other necessary #includes to the header file such that all the structs are fully defined.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by