Fatal error U1077: How do I solve this issue?

42 次查看(过去 30 天)
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
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
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
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
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
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
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\mkvc_lnk.pl 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'
Stop.
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

采纳的回答

Ryan Livingston
Ryan Livingston 2014-3-21
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:
C:\Program
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.
  1 个评论
Hafidz Khairudin
Hafidz Khairudin 2017-8-3
Instead re-installing MATLAB, you can also just include an underscore which is "_" at the space between the words for example:
C:\Program_Files\MATLAB\R2011a\sys\perl\win32\bin\perl

请先登录,再进行评论。

更多回答(1 个)

Jacob
Jacob 2014-3-21
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!

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by