how do I fix "failed to generate all binary outputs" error

356 次查看(过去 30 天)
I have built a simulink model for a VEX microcontroller and it appears to work very well when I simulate it but I get this error when I try to buid it:
Error(s) encountered while building model "test":
### Failed to generate all binary outputs.
the log is:
D:\Users\serickson\Documents\MATLAB\test_grt_rtw>cd .
D:\Users\serickson\Documents\MATLAB\test_grt_rtw>if "" == "" (C:\PROGRA~1\MATLAB\R2014a\bin\win64\gmake -f all ) else (C:\PROGRA~1\MATLAB\R2014a\bin\win64\gmake -f )
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"rtGetInf.obj" "rtGetInf.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"rtGetNaN.obj" "rtGetNaN.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"rt_nonfinite.obj" "rt_nonfinite.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"test.obj" "test.c"
cpp: d:\users\serickson\documents\matlab\test_grt_rtw\test_private.h:55 test.c:17 Could not find include file "API.h"
cpp: d:\users\serickson\documents\matlab\test_grt_rtw\test_private.h:56 test.c:17 Could not find include file "API.h"
0 errors, 2 warnings
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"test_data.obj" "test_data.c"
cpp: d:\users\serickson\documents\matlab\test_grt_rtw\test_private.h:55 test_data.c:17 Could not find include file "API.h"
cpp: d:\users\serickson\documents\matlab\test_grt_rtw\test_private.h:56 test_data.c:17 Could not find include file "API.h"
0 errors, 2 warnings
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcc64 -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=test -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -ID:/Users/serickson/Documents/MATLAB/test_grt_rtw -ID:/Users/serickson/Documents/MATLAB -ID:/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -Fo"rt_main.obj" "C:/PROGRA~1/MATLAB/R2014a/rtw/c/src/common/rt_main.c"
C:/PROGRA~1/MATLAB/R2014a/sys/perl/win32/bin/perl.exe C:/PROGRA~1/MATLAB/R2014a/rtw/c/tools/ test.lnk rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj test.obj test_data.obj rt_logging.obj
"### Creating standalone executable "../test.exe" ..."
C:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/bin/lcclnk64 -s -LC:/PROGRA~1/MATLAB/R2014a/sys/lcc64/lcc64/lib64 -o ../test.exe @test.lnk rt_main.obj
test.obj .text: undefined reference to 'joystickGetAnalog'
test.obj .text: undefined reference to 'motorSet'
gmake: *** [../test.exe] Error 4
D:\Users\serickson\Documents\MATLAB\test_grt_rtw>echo The make command returned an error of 2
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.
can anyone help?

回答(11 个)

Ranush Wickramarathne
I think this error occurs because of the folder names we using and the file's name. Try to avoid keywords which are reserved in matlab and use underscore, dash etc for file names.

change the path of my file because the previous one had folders with space, my new route was: c: / desktop / test / archivosimulink, and it worked, thank you, I think that if you want to leave your route you should remove all the spaces to the folders the route

T Meyers
T Meyers 2020-10-13
I hate to dig up an old thread but sometimes I get "failed to load binaries" error from Matlab Simulink C2000 Coder and wanted to document it.
Like mentioned above, the issue is the ENTIRE folder name (from C:/ down) containing spaces, dashes(-), periods(.) or keywords. When my Matlab folder is in the cloud (i.e. Dropbox) - I am almost guaranteed to encounter this error. My solution - copy the Matlab folder to Downloads and rename it.
If you only get the error in C2000 coder and the folder name was fixed, then C2000 Coder or Code Composer Studio was not properly installed. You might need to reinstall CCS followed by C2000 Coder in that case.

Jan 2014-9-26
This seems to be a reason for failing:
Could not find include file "API.h"
Where is the required file?

Sandeep Math
Sandeep Math 2015-1-6
编辑:Walter Roberson 2018-3-19
Hello Steven,
It appears like the support package installation did not complete successfully because the API.h should have been on your MATLAB path otherwise. The build failed since MATLAB is not able to find this header file. To fix this issue, at the MATLAB Command prompt execute:
This will open a dialog that will let you add folders to MATLAB path. Here, add the following paths and then Save.
Please note that the C:\MATLAB\SupportPackages\R2014b\ in the path names might be different in your case. So navigate to the appropraite folder on your machine and add all these to the MATLAB path. Save and Close.
Now, you should be able to build your model successfully.
If you are still running into issues, please contact us at
  2 个评论
Jan 2016-10-19
Please, Aniket Adhvaryu, post a new question in a new thread, not as comment to an answer to another question. Thanks.


Luke 2017-11-16
just change the CCS version to the one that you have installed in code generation->toolchain.

kang guan guy
kang guan guy 2018-1-27
i also facing this problem. it happen i use external or deploy the hardware.

abdeldjalil mir
abdeldjalil mir 2018-3-19
first you unistall the package from matlab then you go to the directorie where you install the lastest package -delete all folder contaning arduino and package suport -go to matlab and install the package firts you dont get the libraries but if you reinstall the hardware package you will get it
for me i have the same probleme and i resolve it now

TRAN PHUC 2019-2-22
I have a problem. I need help
  1 个评论
Walter Roberson
Walter Roberson 2019-2-22
编辑:Walter Roberson 2019-2-22
You stored your files in E:\new folder with a space in the directory name. You need to rename that directory so that there is no space in the directory name.
Also it looks like you need to switch to fixed-step solver for use with grc.


George Iskander
George Iskander 2019-7-3
Check the folder containing the files, it shouldn't contain spaces or the name of the file itself be a reserved name or contain spaces.

Vasavi Sai
Vasavi Sai 2021-6-14
I faced same problem and I solved it by changing the path.
Just created a folder in desktop and copied file to that folder.
Then start deburging to F28335 controller.
Good Luck


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!

Translated by