04-10-2024 09:53 AM - edited 04-10-2024 10:29 AM
Hi everyone,
I am attempting to compile a Simulink model into .dll that I can then run on LabVIEW. I have MATLAB R2020a installed (Windows 10) with VeriStand Model Generation Framework and VeriStand Model Framework 2020 R6 also installed. As the compiler, I have MS VS 2019 Pro version installed with all the optional files.
I tested to make sure the compiler is being recognised by MATLAB using the following command in MATLAB:
mex -setup -v
I then proceeded to open the MATLAB example "ex_codegen_dsp" to ensure that I can compile regular C/C++ code using Simulink Coder - this also works.
I then attempted to generate the LabVIEW .dll file from "ex_codegen_dsp" by setting the stop time to "inf" and changing the system target file to "veristand.tlc" as per the NI documentation.
When I press "Build" the process runs for about a minute before showing the error pasted below.
Anyone know what is going wrong or how to fix this?
Thanks
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw
### Invoking Target Language Compiler on ex_codegen_dsp.rtw
### Using System Target File: C:\Users\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\VeriStand Model Generation Support\matlab_support\target\veristand.tlc
### Loading TLC function libraries
### Generating TLC interface API for custom data
### Initial pass through model to cache user defined code
.
### Caching model source code
### Generating TLC interface API.
### Writing source file ex_codegen_dsp_capi.cpp
### Writing header file ex_codegen_dsp_capi.h
### Writing header file ex_codegen_dsp_types.h
.
### Writing header file ex_codegen_dsp.h
### Writing header file ex_codegen_dsp_private.h
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing source file ex_codegen_dsp.cpp
.
### Writing header file rtmodel.h
### Writing source file ex_codegen_dsp_data.cpp
### TLC code generation complete.
### Creating HTML report file ex_codegen_dsp_codegen_rpt.html
### Using toolchain: GCC Compiler for VeriStand Windows targets | gmake makefile (64-bit Windows)
### Creating 'H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw\ex_codegen_dsp.mk' ...
### Building 'ex_codegen_dsp': "C:\PROGRA~1\MATLAB\R2020b\bin\win64\gmake" -f ex_codegen_dsp.mk all
H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw>cd .
H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2020b\bin\win64\gmake" -f ex_codegen_dsp.mk all ) else ("C:\PROGRA~1\MATLAB\R2020b\bin\win64\gmake" -f ex_codegen_dsp.mk )
g++ -c -m32 -O2 -DVSMODEL_STEP_SIZE0=0.001000 -DVSMODEL_MAJOR_VERSION=23u -DVSMODEL_MINOR_VERSION=8u -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=1 -DTID01EQ=0 -DMODEL=ex_codegen_dsp -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL @ex_codegen_dsp_comp.rsp -o"ex_codegen_dsp.obj" "H:/Desktop/SANDBO~1/ex_codegen_dsp_veristand_rtw/ex_codegen_dsp.cpp"
'g++' is not recognized as an internal or external command,
operable program or batch file.
gmake: *** [ex_codegen_dsp.obj] Error 1
H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw>echo The make command returned an error of 2
The make command returned an error of 2
H:\Desktop\Sandbox For MATLAB Code Gen\ex_codegen_dsp_veristand_rtw>exit 1
Top model targets built:
Model Action Rebuild Reason
==========================================================================
ex_codegen_dsp Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 1m 9.01s
Error:Error(s) encountered while building "ex_codegen_dsp"
EDIT: A similar error was reported on the forums here recently but with no replies: Error Compiling a Simulink Model with Veristand for Windows Target - NI Community
Solved! Go to Solution.
04-15-2024 05:25 AM - edited 04-15-2024 05:26 AM
UPDATE: I've managed to solve this if anyone else runs into this problem in the future. I followed the solution outlined here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000001DmQcCAK&l=en-US
Seems like I have to use 'veristand.tlc' as the target file after carrying out the fix in the link above. Using 'NIVeriStand.tlc' still does not generate the .dll file even after applying the fix.