NMAKE : fatal error U1052: file 'slrttestmdl.mk' not found

13 views (last 30 days)
I am running slrt on a target computer. When running slrttest, it fails at test 4. I checked the Matlab website for confidence test 4 errors. Our compiler is supported (Visual Studio Community 2017 C++) and our compiler path is in the standard path, but we are still getting the error below. I have not been able to find anybody else with this problem and I don't know where slrttestmdl.mk would be. I am working with 2017b. This is my first time posting so if I'm missing anything, let me know.
### Processing Template Makefile: C:\Program Files\MATLAB\R2017b\toolbox\slrt\rtw\slrt_vc.tmf
### slrttestmdl.mk which is generated from C:\Program Files\MATLAB\R2017b\toolbox\slrt\rtw\slrt_vc.tmf is up to date
### Building slrttestmdl: .\slrttestmdl.bat
C:\Users\mathewp\Downloads\slrttestmdl_slrt_rtw\instrumented>call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\VCVARSALL.BAT " x86
** Visual Studio 2017 Developer Command Prompt v15.0.26730.16
** Copyright (c) 2017 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x86'
Microsoft (R) Program Maintenance Utility Version 14.11.25508.2
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1052: file 'slrttestmdl.mk' not found
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
Error(s) encountered while building "slrttestmdl"

Accepted Answer

Suze Zhang
Suze Zhang on 10 Oct 2017
Hi Alex,
One thing that you may try is to set the environment variable VSCMD_START_DIR in MATLAB. To do so, you can execute the following command in MATLAB Command Window:
>> setenv('VSCMD_START_DIR','%CD%')
Also you can put this in the start up file for MATLAB program, so that you don't have to execute this command every session.
Raphaël Ollivier
Raphaël Ollivier on 28 Oct 2017
Excellent ! That fix worked for me, under r2017a, with both Visual C++ 2017 (15.0) and Visual C++ 2015 (14.0). Thanks a lot !
Adrian Roguski
Adrian Roguski on 25 Oct 2018
It worked for "Error U1052: File 'ntwin32.mak' not found" as well. Thanks!

Sign in to comment.

More Answers (3)

Mathew Peterson
Mathew Peterson on 12 Oct 2017
Hi Suze Zhang, Thanks for answering our question is such a timely manner. When I attempted to use that command though I got an error. So I looked online to find someone with a similar error, there was one who had a similar question asked by Keith Lewis but it was never answered and I couldn't find much on google.
The call to slrt_make_rtw_hook, during the exit hook generated the following error:
Cannot write to destination: C:\Users\mathewp\Downloads\slrttestmdl.mldatx. Use the 'f' option to override.
The build process will terminate as a result.
Caused by:
Cannot write to destination: C:\Users\mathewp\Downloads\slrttestmdl.mldatx. Use the 'f' option to override.

Mathew Peterson
Mathew Peterson on 13 Oct 2017
We fixed this by using the copyfile command:
copyfile myfile1.m myFolder
The copyfile command is making a folder with a myfile.m

guang liu
guang liu on 16 Jan 2021
Hi, Alex and guys:
I met the similar troubles when I compile the model as dll file, the error is as follows, Can you give me some advices,thanks a lot.
Using Microsoft Windows SDK for Windows 7 (7.1.7600.0.30514) C:\Users\lenovo\Documents\MATLAB\untitled_niVeriStand_rtw>cd /d C:\Users\lenovo\Documents\MATLAB\untitled_niVeriStand_rtw\ C:\Users\lenovo\Documents\MATLAB\untitled_niVeriStand_rtw>nmake -f untitled.mk MATLAB_ROOT=D:\Program Files\MATLAB\R2018b ALT_MATLAB_ROOT=D:\Program Files\MATLAB\R2018b MATLAB_BIN= ALT_MATLAB_BIN= EXT_MODE=0 EXTMODE_STATIC_ALLOC=0 TMW_EXTMODE_TESTING=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 EXTMODE_TRANSPORT=0 MAT_FILE=1 NIDEBUG=0 NIOPT="Default" OPTS="" COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 ISPROTECTINGMODEL=NOTPROTECTING /I Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. untitled.mk(139) : fatal error U1052: file 'D:\Program\rtw\c\tools\vctools.mak' not found Stop. C:\Users\lenovo\Documents\MATLAB\untitled_niVeriStand_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:\Users\lenovo\Documents\MATLAB\untitled_niVeriStand_rtw>An_error_occurred_during_the_call_to_make
hb zhao
hb zhao on 12 Jan 2022
hi guangliu, i've encountered the same problem. How did you solve the problem that ' fatal error U1052: D:\Program​\rtw\c\too​ls\vctools​.mak' not found ' ?
Stefanie Schwarz
Stefanie Schwarz on 29 Aug 2022
In your case, the problem seems to be related to the space character in "Program Files" since
is not the correct path to the "vctools.mak" file. It should be:
D:\Program Files\MATLAB\RXXXXx\rtw\c\tools\vctools.mak
(or similar, depending on where you have MATLAB installed on your system).
Please go through the suggestions in the following article:

Sign in to comment.


Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!