MATLAB: Unable to find ‘solver_zc.h’ header file in generated code from Embedded Coder

coderembeddedEmbedded Coderfilesheadermissingpackngosolver_zc.h

When I add the "external reset" signal to my "PID Controller" block, the resulting model can no longer be compiled in my embedded coder target. I get the error message from the compiler: "could not open source file "solver_zc.h"
Where do I get this file? Why isn't embedded coder adding the file it needs to the "ert_rtw" directory?

Best Answer

Embedded Coder does not place the 'solver_zc.h' file in the build directory. This is the case for several such header files, and is expected behavior. To access the 'solver_zc.h' file, please navigate to the path - 'C:\Program Files\MATLAB\R2016a\simulink\include'.
That being said, to be able to consolidate all the required build files in one folder, it is recommended to use the 'packNGo' feature available with Simulink. Please follow the steps provided below to use 'packNGo':
  • In your Simulink model, navigate to the Code Generation tab in Configuration Parameters, and check the 'Package code and artifacts' option. Make sure to provide a name for the zip file.
  • Then, proceed to build the model.
  • This will generate a zip file that contains all the necessary build files.
  • To access the 'solver_zc.h' file, navigate to the folder - '<Zip-Folder-Name>/R2016a/simulink/include/'
  • For further information on packNGo, please refer to the link provided here - https://www.mathworks.com/help/ecoder/ref/packngo.html