Why can my header file not be found during the build process for my Simulink model?
53 views (last 30 days)
Show older comments
MathWorks Support Team
on 15 Jun 2020
Edited: MathWorks Support Team
on 19 Feb 2024
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?
Accepted Answer
MathWorks Support Team
on 19 Feb 2024
Edited: MathWorks Support Team
on 19 Feb 2024
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 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!