Why are some header files such as "ippreconstruct.h" and "tmwtypes.h" not generated even though they are included with "#include" in source code generated with MATLAB Coder?
12 views (last 30 days)
Show older comments
MathWorks Support Team
on 21 May 2018
Edited: MathWorks Support Team
ongeveer 10 uur ago
When I generate code from my MATLAB function using MATLAB Coder, I observe that some files are included in the source code (.C code) using the #include tag, but that these files are not generated as part of the code generation.
For example, files are included as follows:
#include "ippreconstruct.h"
#include "tmwtypes.h"
The above header files, although included in the .C files, are not generated. As a result, when I am using the generated code to compile them in some other application (e.g., Visual Studio), I get the error that these header files are missing.
However, I can observe that some of the other MATLAB specific header files like "rtwtypes.h" do get generated along with the other source code. Why are these files not included?
Accepted Answer
MathWorks Support Team
ongeveer 16 uur ago
Edited: MathWorks Support Team
41 minuten ago
The header files are missing from the generated files because all files which are a part of MATLAB installation (present in the ‘MATLABROOT\extern\include’ directory) do not get copied into the generated code.
Since these files are already available in the MATLAB directory, it is expected that to compile these files it will be possible to simply include the path of these files in the ‘include’ directory of the external compiler.
In contrast, other MATLAB files such as "rtwtypes.h" are generated because these files are not available in the MATLAB installation directory. These files are customized to the specific project for which code is generated and are not generic files.
To generate all included files when generating code, the "packNGo" option can be used, which will create a ZIP folder with all the files included. This option can be used if the generated code needs to be relocated to another development environment. For details, please see documentation on how to Package Code for Other Development Environments.
In addition, the necessary files to include in the external compiler may be found in the MK file, if the MATLAB Coder is configured to generate one.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!