Why can my header file not be found during the build process for my Simulink model?

53 ビュー (過去 30 日間)
Trying to build my Simulink model, I get any of the following errors, depending on the compiler being used
fatal error C1083: Cannot open include file: 'myFile.h': No such file or directory
fatal error #1965: cannot open source file 'myFile.h'
The file is on the MATLAB path, why can it not be found?

採用された回答

MathWorks Support Team
MathWorks Support Team 2024 年 2 月 19 日
編集済み: MathWorks Support Team 2024 年 2 月 19 日
Simulink will pass the current folder as well as any specified include directories path(s) to the build process. If the header file is in neither of these locations, the error above will be thrown by the compiler. Note that the MATLAB search path has no impact on the directories included in the build process.
Check to make sure that the path to the header file is defined in this location:
Simulink Model Settings > Code Generation > Custom Code > Include Directories
Refer to the link below for things to consider when adding paths to the include directories list:
If the header file is related to an S-function, a more advanced, but also more elegant approach to manage your S-function dependencies would be to write a "makecfg.m" file. Through this file, you can specify all dependencies and includes for the S-function. This is particularly recommended if you aim to distribute the S-functions to other users:

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by