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

378 views (last 30 days)
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?
  1 Comment
Guillaume on 25 Sep 2014
Please, use the format code button to make your question readable.

Sign in to comment.

Answers (11)

JUAN JOSE MUÑOZ on 20 Jan 2018
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

Ranush Wickramarathne
Ranush Wickramarathne on 3 Feb 2017
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.

T Meyers
T Meyers on 13 Oct 2020
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 on 26 Sep 2014
This seems to be a reason for failing:
Could not find include file "API.h"
Where is the required file?

Sandeep Math
Sandeep Math on 6 Jan 2015
Edited: Walter Roberson on 19 Mar 2018
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
Jan on 19 Oct 2016
Please, Aniket Adhvaryu, post a new question in a new thread, not as comment to an answer to another question. Thanks.

Sign in to comment.

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

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

abdeldjalil mir
abdeldjalil mir on 19 Mar 2018
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 on 22 Feb 2019
I have a problem. I need help
  1 Comment
Walter Roberson
Walter Roberson on 22 Feb 2019
Edited: Walter Roberson on 22 Feb 2019
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.

Sign in to comment.

George Iskander
George Iskander on 3 Jul 2019
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 on 14 Jun 2021
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 Simulation 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!