MATLAB Answers

No such slros_initialize.h: No such file or directory while generating C++ code fro simulink coder

18 views (last 30 days)
Rahul Bhadani
Rahul Bhadani on 29 Mar 2016
Commented: Anand George on 22 Feb 2017
I was trying to generate code from simulink block using simulink coder. I did following and it generated the code but while compiling it says No such slros_initialize.h: No such file or directory.
How to resolve this error?
>> set_param(mdl,'RTWVerbose','on');
>> rtwbuild(mdl)
### Starting build procedure for model: rangePublish
### Generating code into build folder: /home/jane/ros15/sandbox/rahulbhadani/src/simulink/rangePublish_ert_rtw
### Invoking Target Language Compiler on rangePublish.rtw
### Using System Target File: /usr/local/MATLAB/R2015b/rtw/c/ert/ert.tlc
### Loading TLC function libraries
.......
### Initial pass through model to cache user defined code
...
### Caching model source code
....Warning: A terminate function is necessary, however the code generation process did not generate a terminate function
because the 'Terminate function required' check box is cleared.
...................
### Writing header file rangePublish.h
### Writing source file rangePublish.cpp
.
### Writing header file rtwtypes.h
### Writing source file ert_main.cpp
### TLC code generation complete.
### Creating HTML report file rangePublish_codegen_rpt.html
### Creating project marker file: rtw_proj.tmw
### Using toolchain: GNU gcc/g++ v4.4.x | gmake (64-bit Linux)
### Creating '/home/jane/ros15/sandbox/rahulbhadani/src/simulink/rangePublish_ert_rtw/rangePublish.mk' ...
### Building 'rangePublish': /usr/local/MATLAB/R2015b/bin/glnxa64/gmake -f rangePublish.mk all
g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC -O0 -DONESTEPFCN=1 -DTERMFCN=0 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DMODEL=rangePublish -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DUNIX -I/home/jane/ros15/sandbox/rahulbhadani/src/simulink/rangePublish_ert_rtw -I/home/jane/ros15/sandbox/rahulbhadani/src/simulink -I/usr/local/MATLAB/R2015b/extern/include -I/usr/local/MATLAB/R2015b/simulink/include -I/usr/local/MATLAB/R2015b/rtw/c/src -I/usr/local/MATLAB/R2015b/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2015b/rtw/c/ert -o "rangePublish.o" "rangePublish.cpp"
In file included from rangePublish.cpp:21:0:
rangePublish.h:27:30: fatal error: slros_initialize.h: No such file or directory
#include "slros_initialize.h"
^
compilation terminated.
gmake: *** [rangePublish.o] Error 1
### Build procedure for model: 'rangePublish' aborted due to an error.
Error using coder.make.Builder/coder_diagnose
Error(s) encountered while building "rangePublish":
### Failed to generate all binary outputs.
Error in coder.make.Builder/coder_build
Error in coder.make.Builder/run
Error in coder.make.invokeBuilder
Error in RTW/genMakefileAndBuild>locGenMakefileAndBuild
Error in RTW/genMakefileAndBuild
Error in RTW/genMakefileAndBuildWrapper
Error in coder.internal.runCompile
Error in coder.internal.ModelBuilder/make_rtw (line 919)
compileResult = coder.internal.runCompile...
Error in coder.internal.ModelCodegenMgr/make_rtw (line 8)
buildResult = obj.make_rtw(varargin);
Error in make_rtw (line 18)
buildResult = h.make_rtw(varargin{:});
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in slbuild (line 61)
sl('slbuild_private', mdl, varargin{:});
Error in rtwbuild (line 189)
slbuild(sys, 'StandaloneRTWTarget', ...
  1 Comment
Anand George
Anand George on 22 Feb 2017
I solved this problem by setting: code--> c/c++-Code --> Code Generation Options --> Hardware Implementation --> Hardware board
set this parameter to ROS.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!