MATLAB: Do I receive a link error when building a GRT-based model with Microsoft Visual C++ in Real-Time Workshop 7.0 (R2007b)

simulink coder

When I select 'MSVC' as my compiler using MEX -SETUP and then build one of the Real-Time Workshop demo models using the GRT target, I receive the following error:
link /RELEASE /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO -subsystem:console,4.0 libcmt.lib oldnames.lib kernel32.lib ws2_32.lib mswsock.lib advapi32.lib libcpmt.lib D:\MATLAB\R2007a\rtw\c\lib\win32\rtwlib_vc.lib @xpcosc.lnk @xpcosc_ref.rsp -out:..\xpcosc.exe
link: invalid option -- s
Try `link --help' for more information.
NMAKE : fatal error U1077: 'link' : return code '0x1'
Stop.
D:\Documents\My Documents\MATLAB\xpcosc_grt_rtw>echo The make command returned an error of 2
The make command returned an error of 2

Best Answer

The underlying reason for the error is that the incorrect linker is called during build process, because another file called 'link.exe' exists in a folder that precedes the MSVC folder in the system path.
Real-Time Workshop does not have the ability to ensure that the MSVC folder precedes other compiler/linker folders that may present naming conflicts in the system path. The problem must be addressed by removing the conflict, for example, by modifying or reordering the system path.