Simulink Coder - Cannot open include file: 'nesl_rtw.h'

19 views (last 30 days)
Istvan Burbank
Istvan Burbank on 4 Aug 2015
Answered: Michael Burke on 4 Jan 2019
I am using Simulink Coder to compile my simulink model into a shared library (embedded target) which I then try to load into MATLAB using coder.loadlibrary. Upon executing the following command, I get an error:
libModelPath = fullfile(pwd, 'mylib_ert_shrlib_rtw');
libSimulinkPath = fullfile(matlabroot, 'simulink', 'include');
hfile = fullfile(libModelPath, 'mylib.h');
coder.loadlibrary('mylib_win64', hfile, ...
'includepath', libModelPath, ...
'includepath', libSimulinkPath, ...
'mfilename', 'testfile', ...
'alias', 'mylibrary')
The error I get is:
coder.loadlibrary('mylib, hfile)
Error using loadlibrary (line 447)
Failed to preprocess the input file.
Output from preprocessor is:'mylib.h
C:\Users\[...]\'mylib_ert_shrlib_rtw\'mylib.h(28)
: fatal error C1083: Cannot open include file: 'nesl_rtw.h': No such file or directory
Lines 18-30 of mylib.h:
#ifndef RTW_HEADER_mylib_h_
#define RTW_HEADER_mylib_h_
#include <math.h>
#include <float.h>
#include <string.h>
#ifndef mylib_COMMON_INCLUDES_
# define mylib_COMMON_INCLUDES_
#include "rtwtypes.h"
#include "rtw_continuous.h"
#include "rtw_solver.h"
#include "nesl_rtw.h"
#include "mylib_8bed9f9f_gateway.h"
#endif /* mylib_COMMON_INCLUDES_ */
A quick search of my system doesn't produce a file named nesl_rtw.h.

Answers (2)

zijin wang
zijin wang on 26 Apr 2017
你好,我也遇到相同的问题,想问你解决没有,谢谢

Michael Burke
Michael Burke on 4 Jan 2019
The nesl_rtw.h file is part of the
<MATLAB_ROOT>/toolbox/physmod/simscape/engine/sli/<ARCH>/
Directory where <ARCH> is the architecture you are running on the "ARCH" will change.
Note: You may need to include additional directories. You can search the MATLAB path using the internal file search tool

Community Treasure Hunt

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

Start Hunting!

Translated by