Can't Rebuild ext_comm and ext_serial_win32 MEX-Files which in matlab help

1 vue (au cours des 30 derniers jours)
Lo jungle
Lo jungle le 14 Août 2021
Réponse apportée : Lo jungle le 15 Août 2021
THe code in matlab help seems wrong!
I used This code to Rebuild ext_comm and ext_serial_win32 MEX-Files
cd (matlabroot)
mex toolbox/coder/simulinkcoder_core/ext_mode/host/common/ext_comm.c ...
toolbox/coder/simulinkcoder_core/ext_mode/host/common/ext_convert.c ...
toolbox/coder/simulinkcoder_core/ext_mode/host/common/rtiostream_interface.c ...
toolbox/coder/simulinkcoder_core/ext_mode/host/common/ext_util.c ...
-R2018a ...
-Itoolbox/coder/rtiostream/src ...
-Itoolbox/coder/rtiostream/src/utils_host ...
-Itoolbox/coder/simulinkcoder_core/ext_mode/host/common/include ...
-Irtw/c/src/ext_mode/common ...
-lmwrtiostreamutils -lmwsl_services ...
-DEXTMODE_TCPIP_TRANSPORT ...
-DSL_EXT_DLL -output my_ext_comm
It get a error!
错误使用 mex
ext_comm.c
toolbox\coder\rtiostream\src\utils\rtiostream_utils.h(13): fatal error C1083: Can't open: "rtwtypes.h": No
such file or directory
And i found a file in matlab directory and add it in the command like this
mex toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_comm.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_convert.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\rtiostream_interface.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_util.c ...
-Irtw\c\src -Itoolbox\coder\rtiostream\src\utils ...
-Irtw\c\src\ext_mode\common ...
-Itoolbox\rtw\rtwdemos\EmbeddedCoderOverview\CodeMetricFiles\PCG_Eval_CodeMetrics_3...
-Itoolbox\coder\simulinkcoder_core\ext_mode\host\common ...
-Itoolbox\coder\simulinkcoder_core\ext_mode\host\common\include ...
-llibmwrtiostreamutils -llibmwsl_services ...
-DEXTMODE_TCPIP_TRANSPORT ...
-DSL_EXT_DLL -output my_ext_comm
error use mex
ext_comm.c
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(60): error
C2061: ind"libH_type"
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(64): error
C2059: language misstake:"}"
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(74): error
C2143: language misstake: miss")"(in front of "*")
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(74): error
C2143: language misstake: miss"{"(in front of "*")
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(74): error
C2059: language misstake:)
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(77): error
C2143: language misstake: miss)(in front of "*")
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(77): error
C2143: language misstake: miss{(in front of "*")
d:\program files\polyspace\r2020b\toolbox\coder\simulinkcoder_core\ext_mode\host\common\extutil.h(77): error
C2059: language misstake:)
THe code in matlab help seems wrong!

Réponses (1)

Lo jungle
Lo jungle le 15 Août 2021
I have solved this Probelm!~
first,foud the rtwtypes.h files in matlab directory,such as toolbox\rtw\accel\accelTemplateFolder,
next the code in matlab help is wrong,use
-Irtw\c\src -Itoolbox\coder\rtiostream\src\utils_host
instead of
-Irtw\c\src -Itoolbox\coder\rtiostream\src\utils
Use this code we can build the mex file successfully.
The fully code behind
mex toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_comm.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_convert.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\rtiostream_interface.c ...
toolbox\coder\simulinkcoder_core\ext_mode\host\common\ext_util.c ...
-Irtw\c\src -Itoolbox\coder\rtiostream\src\utils_host ...
-Itoolbox\rtw\accel\accelTemplateFolder...
-Itoolbox\coder\rtiostream\src...
-Irtw\c\src\ext_mode\common ...
-Itoolbox\coder\simulinkcoder_core\ext_mode\host\common ...
-Itoolbox\coder\simulinkcoder_core\ext_mode\host\common\include ...
-lmwrtiostreamutils -lmwsl_services ...
-DEXTMODE_TCPIP_TRANSPORT ...
-DSL_EXT_DLL -output my_ext_comm

Community Treasure Hunt

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

Start Hunting!

Translated by