MATLAB Answers


Fatal error U1077: How do I solve this issue?

Asked by Jacob
on 20 Mar 2014
Latest activity Edited by John Kelly
on 27 Feb 2015

I am trying to compile models into a .dll in order use for HIL simulation, but MATLAB shows en error when I attempt to build the file. I have the correct System Target File selected, the Solver is selected as Fixed-Step Discrete, and I ran the mex -setup to select the Microsoft Visual C++ 2010 Express compiler on my PC. Once I attempt to build, I get the following:

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved.

        1 file(s) copied. 
        1 file(s) copied. 
### Compiling the source Compile_Model_Example 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT -DNI_VERISTAND_MAINMODELFILE Compile_Model_Example.c 
### Compiling the model data file Compile_Model_Example_data 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT -DNI_VERISTAND_MODELDATAFILE Compile_Model_Example_data.c 
### Compiling rtGetInf.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rtGetInf.c 
### Compiling rtGetNaN.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rtGetNaN.c 
### Compiling rt_nonfinite.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT rt_nonfinite.c 
### Compiling NIVeriStand_main.c 
	cl -Od  -DUSE_RTMODEL -DNI_ROOTMODEL_Compile_Model_Example -DMODEL=Compile_Model_Example -DRT -DNUMST=1  -DTID01EQ=0 -DNCSTATES=0  -DMT=0 -DHAVESTDIO -DNATIONAL_INSTRUMENTS_SIT  -D_CRT_SECURE_NO_DEPRECATE   -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 /MT NIVeriStand_main.c 
### Compiling Compile_Model_Example.rc 
	rc Compile_Model_Example.rc 
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385  
Copyright (C) Microsoft Corporation.  All rights reserved.  

### Linking ...

C:\Program Files\MATLAB\R2011a\sys\perl\win32\bin\perl C:\Program Files\MATLAB\R2011a\rtw\c\tools\ Compile_Model_Example.lnk Compile_Model_Example.obj Compile_Model_Example_data.obj rtGetInf.obj rtGetNaN.obj rt_logging.obj rt_nonfinite.obj NIVeriStand_main.obj rt_sim.obj Compile_Model_Example.res

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

NMAKE : fatal error U1077: 'C:\Program' : return code '0x1'


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. ### Build procedure for model: 'Compile_Model_Example' aborted due to an error.


I also noticed I get a similar statement when running mex -setup:

>> mex -setup

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Welcome to mex -setup. This utility will help you set up a default compiler.

Please choose your compiler for building MEX-files:

Would you like mex to locate installed compilers [y]/n?

What should I do next to fix this issue? Thanks


2 Answers

Answer by Ryan Livingston
on 21 Mar 2014
 Accepted answer

Hi Jacob,

It looks like the generated make file is having issues because of the space in the path C:\Program Files. It is trying to run the line:

 C:\Program Files\MATLAB\R2011a\sys\perl\win32\bin\perl 

which is being interpreted by the OS as the command:


This issue is described with workarounds here:

The ideas are to either change the Windows registry so it uses short pathnames which will remove the space or to re-install MATLAB in a directory without spaces.


Answer by Jacob
on 21 Mar 2014

Thanks for the help Ryan. I was unable to fix it by following SOLUTION 1, hence I went ahead with SOLUTION 2 and reinstalled MATLAB into a folder on the C: drive with a name that did not contain blank spaces. Following this instruction I was able to solve this issue, but unfortunately encountered another error related to the compiler (which will be posted as a seperate discussion). Onto the next one!

Thanks again!


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today