I am unable to compile and execute SystemC code generated from a Simulink model

The code generation is successfull but when I click on "Verify TLM Component" in the Configuration Parameter window inside the TLM Testbench panel I get the following error,
### Starting component verification
### Checking available compiler.
### Building testbench and TLM component.
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VSCMD_START_DIR=C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.58
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake.exe /nologo /f makefile.mk all-am OPT_CXXFLAGS="/O2 /MT /D _NDEBUG" OPT_LDFLAGS=""
cd ..\DualFilter_uttb_tlm && nmake.exe /nologo /f makefile.mk all-am
cd ..\DualFilter && nmake.exe /nologo /f makefile.mk all-am
cl.exe /c /O2 /MT /D _NDEBUG /Fd".\obj\DualFilter_uttb_tlm.pdb" /D "RT" /D "USE_RTMODEL" /D "WIN64" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "_UNICODE" /D "UNICODE" /I ".\include" /I "..\DualFilter\include" /I "..\DualFilter\utils" /I "" /I "" /D SC_INCLUDE_DYNAMIC_PROCESSES /nologo /FD /EHsc /W3 /TP /wd4244 /wd4267 /vmg /Foobj\DualFilter_uttb_tlm.obj src\DualFilter_uttb_tlm.cpp
cl : Command line error D8004 : '/I' requires an argument
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

10 Comments

Sure, but I am not touching the generated code or the makefile before compiling. Are you saying the makefile automatically generated by simulink needs to be corrected so that I can compile the code properly?
I would suspect that you have left two configuration fields empty but that the makefile is blindly putting in those two empty values instead of just leaving that part out.
I set the environment vairables SYSTEMC_INC_PATH and TLM_INC_PATH, and the problem went away. But now I get a different error,
### Starting component verification
### Checking available compiler.
### Building testbench and TLM component.
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VSCMD_START_DIR=C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.58
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake.exe /nologo /f makefile.mk all-am OPT_CXXFLAGS="/O2 /MT /D _NDEBUG" OPT_LDFLAGS=""
cd ..\DualFilter_uttb_tlm && nmake.exe /nologo /f makefile.mk all-am
cd ..\DualFilter && nmake.exe /nologo /f makefile.mk all-am
cl.exe /c /O2 /MT /D _NDEBUG /Fd".\obj\DualFilter_uttb_tlm.pdb" /D "RT" /D "USE_RTMODEL" /D "WIN64" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "_UNICODE" /D "UNICODE" /I ".\include" /I "..\DualFilter\include" /I "..\DualFilter\utils" /I "C:\Users\advaitthakre\Downloads\systemc-2.3.1\systemc-2.3.1\src" /I "C:\Users\advaitthakre\Downloads\systemc-2.3.1\systemc-2.3.1\src" /D SC_INCLUDE_DYNAMIC_PROCESSES /nologo /FD /EHsc /W3 /TP /wd4244 /wd4267 /vmg /Foobj\DualFilter_uttb_tlm.obj src\DualFilter_uttb_tlm.cpp
DualFilter_uttb_tlm.cpp
Unknown compiler version - please run the configure tests and report the results
C:\Users\advaitthakre\Downloads\systemc-2.3.1\systemc-2.3.1\src\systemc.h(118): error C2039: 'gets': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\map(20): note: see declaration of 'std'
C:\Users\advaitthakre\Downloads\systemc-2.3.1\systemc-2.3.1\src\systemc.h(118): error C2873: 'gets': symbol cannot be used in a using-declaration
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
After setting all the environment variables now I am stuck with this error,
### Starting component verification
### Checking available compiler.
### Building testbench and TLM component.
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VSCMD_START_DIR=C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.58
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake.exe /nologo /f makefile.mk all-am OPT_CXXFLAGS="/O2 /MT /D _NDEBUG" OPT_LDFLAGS=""
cd ..\DualFilter_uttb_tlm && nmake.exe /nologo /f makefile.mk all-am
cd ..\DualFilter && nmake.exe /nologo /f makefile.mk all-am
link.exe obj\mw_support_tb.obj obj\DualFilter_uttb_tlm_tb.obj obj\DualFilter_uttb_tlm_tb_main.obj /LIBPATH:"C:\Users\advaitthakre\Downloads\systemc-2.3.4\src" /LIBPATH:"C:\Program Files\MATLAB\R2023b\extern\lib\win64\microsoft" /nologo /INCREMENTAL /SUBSYSTEM:CONSOLE /MACHINE:X64 ..\DualFilter_uttb_tlm\lib\DualFilter_uttb_tlm.lib ..\DualFilter\lib\DualFilter.lib "" libmat.lib libmx.lib libeng.lib /PDB:".\obj\DualFilter_uttb_tlm_tb.pdb" /out:DualFilter_uttb_tlm_tb.exe
LINK : fatal error LNK1104: cannot open file '.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
C:\Users\advaitthakre\Downloads\systemc-2.3.1\systemc-2.3.1\src\systemc.h(118): error C2039: 'gets': is not a member of 'std'
std::gets was deprecated in C++11 and removed in C++14
I was able to get around std::gets error after I set all environment variables. Like I posted in my last message I am stuck on a different error now,
### Starting component verification
### Checking available compiler.
### Building testbench and TLM component.
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>set "VSCMD_START_DIR=C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb"
C:\Users\advaitthakre\Documents\SystemC\DualFilter_VP\DualFilter_uttb_tlm_tb>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.58
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake.exe /nologo /f makefile.mk all-am OPT_CXXFLAGS="/O2 /MT /D _NDEBUG" OPT_LDFLAGS=""
cd ..\DualFilter_uttb_tlm && nmake.exe /nologo /f makefile.mk all-am
cd ..\DualFilter && nmake.exe /nologo /f makefile.mk all-am
link.exe obj\mw_support_tb.obj obj\DualFilter_uttb_tlm_tb.obj obj\DualFilter_uttb_tlm_tb_main.obj /LIBPATH:"C:\Users\advaitthakre\Downloads\systemc-2.3.4\src" /LIBPATH:"C:\Program Files\MATLAB\R2023b\extern\lib\win64\microsoft" /nologo /INCREMENTAL /SUBSYSTEM:CONSOLE /MACHINE:X64 ..\DualFilter_uttb_tlm\lib\DualFilter_uttb_tlm.lib ..\DualFilter\lib\DualFilter.lib "" libmat.lib libmx.lib libeng.lib /PDB:".\obj\DualFilter_uttb_tlm_tb.pdb" /out:DualFilter_uttb_tlm_tb.exe
LINK : fatal error LNK1104: cannot open file '.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
I do not know? The only thing I notice is that between ..\DualFilter\lib\DualFilter.lib and libmat.lib there is a "" and possibly that is being treated as an empty name with default extension .obj
Based on the compilation log, the environment variables pointing to your SystemC library installation are missing
cl.exe /c /O2 /MT /D _NDEBUG /Fd".\obj\DualFilter_uttb_tlm.pdb" /D "RT" /D "USE_RTMODEL" /D "WIN64" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "_UNICODE" /D "UNICODE" /I ".\include" /I "..\DualFilter\include" /I "..\DualFilter\utils" /I "" /I "" /D SC_INCLUDE_DYNAMIC_PROCESSES /nologo /FD /EHsc /W3 /TP /wd4244 /wd4267 /vmg /Foobj\DualFilter_uttb_tlm.obj src\DualFilter_uttb_tlm.cpp
cl : Command line error D8004 : '/I' requires an argument
You must download and compile the SystemC library and define the following variables in your system (or enter the values directly in the 'TLM Compilation' dialog):
  • SYSTEMC_INC_PATH and TLM_INC_PATH to provide the path to the systemC and tlm .h include files
  • SYSTEMC_LIB_NAME and SYSTEMC_LIB_PATH to provide the name and location of the systemC .lib static library file.
Based on the linker log, SYSTEMC_LIB_NAME environment variable is missing
link.exe obj\mw_support_tb.obj obj\DualFilter_uttb_tlm_tb.obj obj\DualFilter_uttb_tlm_tb_main.obj /LIBPATH:"C:\Users\advaitthakre\Downloads\systemc-2.3.4\src" /LIBPATH:"C:\Program Files\MATLAB\R2023b\extern\lib\win64\microsoft" /nologo /INCREMENTAL /SUBSYSTEM:CONSOLE /MACHINE:X64 ..\DualFilter_uttb_tlm\lib\DualFilter_uttb_tlm.lib ..\DualFilter\lib\DualFilter.lib "" libmat.lib libmx.lib libeng.lib /PDB:".\obj\DualFilter_uttb_tlm_tb.pdb" /out:DualFilter_uttb_tlm_tb.exe

Sign in to comment.

Answers (2)

You appear to have a missing the specification of the systemc library and so it is showing up as an empty string in the linker line:
..\DualFilter\lib\DualFilter.lib "" libmat.lib
Please read through:
Here is a successful link command for a design named "Subsystem".
link.exe \
obj\mw_support_tb.obj obj\Subsystem_tlm_tb.obj obj\Subsystem_tlm_tb_main.obj \
/LIBPATH:"F:/tools/SystemC/systemc-2.3.1/lib/win64" /LIBPATH:"O:\27\matlab\extern\lib\win64\microsoft" \
/nologo /INCREMENTAL /SUBSYSTEM:CONSOLE /MACHINE:X64 \
..\Subsystem_tlm\lib\Subsystem_tlm.lib ..\Subsystem\lib\Subsystem.lib \
"systemc-vs-15.0.lib" \
libmat.lib libmx.lib libeng.lib \
/PDB:".\obj\Subsystem_tlm_tb.pdb" /out:Subsystem_tlm_tb.exe
If you continue to have issues, you can file a tech support request and we can look further.
Based on the compilation log, the environment variables pointing to your SystemC library installation are missing
cl.exe /c /O2 /MT /D _NDEBUG /Fd".\obj\DualFilter_uttb_tlm.pdb" /D "RT" /D "USE_RTMODEL" /D "WIN64" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "_UNICODE" /D "UNICODE" /I ".\include" /I "..\DualFilter\include" /I "..\DualFilter\utils" /I "" /I "" /D SC_INCLUDE_DYNAMIC_PROCESSES /nologo /FD /EHsc /W3 /TP /wd4244 /wd4267 /vmg /Foobj\DualFilter_uttb_tlm.obj src\DualFilter_uttb_tlm.cpp
cl : Command line error D8004 : '/I' requires an argument
You must download and compile the SystemC library and define the following variables in your system (or enter the values directly in the 'TLM Compilation' dialog):
  • SYSTEMC_INC_PATH and TLM_INC_PATH to provide the path to the systemC and tlm .h include files
  • SYSTEMC_LIB_NAME and SYSTEMC_LIB_PATH to provide the name and location of the systemC .lib static library file.

Asked:

on 14 Nov 2023

Edited:

on 22 Nov 2023

Community Treasure Hunt

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

Start Hunting!