### Failed to generate all binary outputs.

77 次查看(过去 30 天)
M J
M J 2017-9-12
评论: ksicide 2022-11-15
Hi, I have Arduino Uno and im trying to build model using Simulink but I get this error
#
## Generating code into build folder: C:\Users\aajma\Desktop\untitled_ert_rtw
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: D:\MATLAB\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file untitled.h
### Writing header file untitled_types.h
### Writing source file untitled.c
### Writing header file rtwtypes.h
### Writing header file untitled_private.h
.
### Writing source file untitled_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.6.13 | gmake (64-bit Windows)
### 'C:\Users\aajma\Desktop\untitled_ert_rtw\untitled.mk' is up to date
### Building 'untitled': D:\MATLAB\bin\win64\gmake -f untitled.mk all
C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10613 -MMD -MP -MF"MW_digitalio.dep" -MT"MW_digitalio.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinobase/include -ID:/MATLAB/simulink/include/sf_runtime -IC:/Users/aajma/Desktop/untitled_ert_rtw -IC:/Users/aajma/Desktop -ID:/MATLAB/extern/include -ID:/MATLAB/simulink/include -ID:/MATLAB/rtw/c/src -ID:/MATLAB/rtw/c/src/ext_mode/common -ID:/MATLAB/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/libraries/Servo/src -IC:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/shared/externalmode_daemon/include -o "MW_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp"
The system cannot find the path specified.
gmake: *** [MW_digitalio.o] Error 1
### Creating HTML report file untitled_codegen_rpt.html
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.
I looked for previous questions but I could not find same my problem
  1 个评论
Walter Roberson
Walter Roberson 2017-9-16
I am not positive, but I think it is saying that it cannot find
C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-g++
I would say that is a normal looking location to expect to find that software, but I notice you are using
D:\MATLAB\bin\win64\gmake
on drive D. That leads me to wonder if your MATLAB support packages are installed on drive D: but it is looking for them on drive C:

请先登录,再进行评论。

回答(11 个)

Fakhreddin Amirhosseini
SOLVED MY PROBLEM!
I had the same problem because of my directory name in the path.
my working directory name was "New Folder" and Matlab ignores what comes after space. I renamed it to "New_Folder" and it solved the problem.

Young Zhang
Young Zhang 2019-5-6
Tick the box 'Generate code only' under Code gen list.

yasir ameen
yasir ameen 2017-9-16
i have same problem , and all my tries to overcome the problem are failed yet.

Jan
Jan 2017-9-16
I'd start with checking the existence of all folders, which appear in the message:
C = {'C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-g++'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinobase/include'
'D:/MATLAB/simulink/include/sf_runtime'
'C:/Users/aajma/Desktop/untitled_ert_rtw'
'C:/Users/aajma/Desktop'
'D:/MATLAB/extern/include'
'D:/MATLAB/simulink/include'
'D:/MATLAB/rtw/c/src'
'D:/MATLAB/rtw/c/src/ext_mode/common'
'D:/MATLAB/rtw/c/ert'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/a…'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variant…'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/libraries/Servo/src'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinotarget/registry/../include'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/inclu…'
'C:/ProgramData/MATLAB/SupportPackages/R2016b/toolbox/target/shared/externalmode_daemon/include'};
for k = 1:numel(C)
if ~exist(C{k}, 'dir')
fprintf('missing: %s\n', C{k});
end
end
Does this reveal anything?

Muhammad Yamman
Muhammad Yamman 2017-12-3
编辑:Walter Roberson 2018-6-6
I am Having same problem, Model INFO: I have an S-Function in my code which I made for Ultrasonic Sensor (HC-SR 04) interfacing with Arduino. which is successfully built, please help me figure out the problem. I a Simulink and Coding beginner. I don't know much about it just learned making S-FUnction from some PDF. Here is my Diagnostic Viewer Error:
### Generating code into build folder: E:\MATLAB_CD\S_Function_HC_SR_04\Test_SR04_PWM_ert_rtw
### Invoking Target Language Compiler on Test_SR04_PWM.rtw
### Using System Target File: C:\Program Files\MATLAB\R2016a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file Test_SR04_PWM.h
.
### Writing header file Test_SR04_PWM_types.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
.
### Writing source file Test_SR04_PWM.c
### Writing header file Test_SR04_PWM_private.h
### Writing source file Test_SR04_PWM_data.c
### Writing header file rtmodel.h
### Writing header file rt_nonfinite.h
.
### Writing source file rt_nonfinite.c
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### Writing source file ert_main.c
### TLC code generation complete.
### Generating TLC interface API.
### Creating data type transition file Test_SR04_PWM_dt.h
.### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.6.1 | gmake (64-bit Windows)
### 'E:\MATLAB_CD\S_Function_HC_SR_04\Test_SR04_PWM_ert_rtw\Test_SR04_PWM.mk' is up to date
### Building 'Test_SR04_PWM': C:\PROGRA~1\MATLAB\R2016a\bin\win64\gmake -f Test_SR04_PWM.mk all
g++ -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10601 -MMD -MP -MF"RTGETINF.dep" -MT"RTGETINF.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=Test_SR04_PWM -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=5 -DMW_PRESCALAR=64 -DMW_TIMERCOUNT=65531 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=Test_SR04_PWM -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -IC:/PROGRA~1/MATLAB/R2016a/simulink/include/sf_runtime -IE:/MATLAB_CD/S_Function_HC_SR_04/Test_SR04_PWM_ert_rtw -IE:/MATLAB_CD/S_Function_HC_SR_04 -IC:/PROGRA~1/MATLAB/R2016a/extern/include -IC:/PROGRA~1/MATLAB/R2016a/simulink/include -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2016a/toolbox/coder/rtiostream/src/utils -IC:/MATLAB/SupportPackages/R2016a/arduino-1.6.1/hardware/arduino/avr/cores/arduino -IC:/MATLAB/SupportPackages/R2016a/arduino-1.6.1/hardware/arduino/avr/variants/mega -IC:/MATLAB/SupportPackages/R2016a/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2016a/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -IC:/MATLAB/SupportPackages/R2016a/toolbox/target/supportpackages/arduinobase/include -c -o RTGETINF.o RTGETINF.C
'g++' is not recognized as an internal or external command,
operable program or batch file.
gmake: *** [RTGETINF.o] Error 1
### Creating HTML report file Test_SR04_PWM_codegen_rpt.html
### Build procedure for model: 'Test_SR04_PWM' aborted due to an error.
Error(s) encountered while building "Test_SR04_PWM":
### Failed to generate all binary outputs.
  1 个评论
Venkatesh Chilapur
Venkatesh Chilapur 2017-12-4
Hi Muhammad,
Do you mind attaching the model that would reproduce the error.
Regards, MW-Support

请先登录,再进行评论。


Amir Mashayekh
Amir Mashayekh 2018-5-27
Hi. I have the similar problem. til 2 weeks ago my program was working. but now i do not know what happened. i would be glad if any one can help me. the error message is like this:
### Generating code into build folder: C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw
The file containing block diagram 'Motor_test3' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behavior. For more information see "Avoiding Problems with Shadowed Files" in the Simulink documentation.
The file containing the block diagram is: C:\Users\AmirMM\Desktop\Motor_test3.slx.
The file higher on the MATLAB path is: C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3.slx [2 similar]
Component:Simulink | Category:Block diagram warning
### Invoking Target Language Compiler on Motor_test3.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
......
### Initial pass through model to cache user defined code
...
### Caching model source code
........................................................................
### Writing header file Motor_test3_types.h
### Writing source file Motor_test3.c
### Writing header file Motor_test3_private.h
.
### Writing header file Motor_test3.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing header file rtGetNaN.h
.
### Writing source file rtGetNaN.c
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing source file Motor_test3_data.c
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Generating TLC interface API.
......................................
### Creating data type transition file Motor_test3_dt.h
.[Warning: Name is nonexistent or not a directory: C:\Users\AmirMM\Documents\MATLAB\Master Project]
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.8.1 | gmake (64-bit Windows)
### 'C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw\Motor_test3.mk' is up to date
### Building 'Motor_test3': "C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f Motor_test3.mk all
C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw>cd .
C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f Motor_test3.mk all ) else ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f Motor_test3.mk )
C:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_digitalio.dep" -MT"MW_digitalio.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=Motor_test3 -DNUMST=2 -DNCSTATES=1 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_TIMERID=5 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=64911 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Motor_test3 -DNUMST=2 -DNCSTATES=1 -DHAVESTDIO -IC:/Users/AmirMM/Documents/MATLAB/MasterProject -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/blocks/sfcn/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include/sf_runtime -IC:/Users/AmirMM/Documents/MATLAB/MasterProject/Motor_test3_ert_rtw -IC:/Users/AmirMM/Desktop -IC:/PROGRA~1/MATLAB/R2017b/extern/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2017b/toolbox/coder/rtiostream/src/utils -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/variants/mega -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/shared/externalmode_daemon/include -o MW_digitalio.o C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp
In file included from C:/Users/AmirMM/Documents/MATLAB/MasterProject/Arduino.h:56:0,
from C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:1:
C:/Users/AmirMM/Documents/MATLAB/MasterProject/compiler.h:917:4: error: #error If you are here, you should check what is exactly the processor you are using...
#error If you are here, you should check what is exactly the processor you are using...
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp: In function 'void digitalIOSetup(uint8_T, boolean_T)':
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:10:22: error: 'OUTPUT' was not declared in this scope
pinMode(pin, OUTPUT);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:10:28: error: 'pinMode' was not declared in this scope
pinMode(pin, OUTPUT);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:13:22: error: 'INPUT' was not declared in this scope
pinMode(pin, INPUT);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:13:27: error: 'pinMode' was not declared in this scope
pinMode(pin, INPUT);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp: In function 'void writeDigitalPin(uint8_T, boolean_T)':
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:21:31: error: 'digitalWrite' was not declared in this scope
digitalWrite(pin, HIGH);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:24:30: error: 'digitalWrite' was not declared in this scope
digitalWrite(pin, LOW);
^
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp: In function 'boolean_T readDigitalPin(uint8_T)':
C:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp:33:27: error: 'digitalRead' was not declared in this scope
ret = (digitalRead(pin) == HIGH) ? 1:0;
^
gmake: *** [MW_digitalio.o] Error 1
C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\AmirMM\Documents\MATLAB\MasterProject\Motor_test3_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file Motor_test3_codegen_rpt.html
### Build procedure for model: 'Motor_test3' aborted due to an error.
Error(s) encountered while building "Motor_test3":
### Failed to generate all binary outputs.
  1 个评论
Walter Roberson
Walter Roberson 2018-6-6
Something in your configuration refers to
C:\Users\AmirMM\Documents\MATLAB\Master Project
but your actual directory name is MasterProject with no space.

请先登录,再进行评论。


Ainoha Cruz Marrero
Hi! I am having the same problem and I am not sure why. I am doing a current controller in Simulink for using it in a Beagle Bone Black and when I deploy to hardware I get this:
Build 3 1 Clear
05:34 PM Elapsed: 9 sec
### Starting build procedure for model: CurrentController
### Generating code and artifacts to 'Model specific' folder structure
Code Generation 1
Elapsed: 7 sec
### Generating code into build folder: C:\Users\A&A\Desktop\CurrentController_ert_rtw
### Invoking Target Language Compiler on CurrentController.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file CurrentController_types.h
### Writing header file CurrentController.h
.
### Writing header file rtwtypes.h
### Writing source file CurrentController.c
### Writing header file CurrentController_private.h
### Writing source file CurrentController_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
.
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: LCC-win64 v2.4.1 | gmake (64-bit Windows)
### 'C:\Users\A&A\Desktop\CurrentController_ert_rtw\CurrentController.mk' is up to date
### Building 'CurrentController': "C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f CurrentController.mk all
C:\Users\A&A\Desktop\CurrentController_ert_rtw>set MATLAB=C:\Program Files\MATLAB\R2017b
C:\Users\A&A\Desktop\CurrentController_ert_rtw>cd .
C:\Users\A&A\Desktop\CurrentController_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f CurrentController.mk all ) else ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f CurrentController.mk )
"C:/PROGRA~1/MATLAB/R2017b/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017b/sys/lcc64/lcc64/include64 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot="C:\ProgramData\MATLAB\SupportPackages\R2017b\toolbox\target\supportpackages\beaglebone\libc" -DMODEL=CurrentController -DNUMST=3 -DNCSTATES=1 -DHAVESTDIO -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DARM_PROJECT -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DARM_PROJECT -DSTACK_SIZE=64 -DRT -DMODEL=CurrentController -DNUMST=3 -DNCSTATES=1 -DHAVESTDIO -IC:/Users/A&A/Desktop -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arm_cortex_a/blocks/sfcn/include -IC:/Users/A&A/Desktop/CurrentController_ert_rtw -IC:/Users/A&A/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2017b/extern/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arm_cortex_a/blocks/sfcn/src -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/beaglebone/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arm_cortex_a/include -IC:/PROGRA~1/MATLAB/R2017b/toolbox/target/codertarget/rtos/inc -Fo"CurrentController.obj" "CurrentController.c"
'C:\Users\A' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
gmake: *** [CurrentController.obj] Error 1
C:\Users\A&A\Desktop\CurrentController_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\A&A\Desktop\CurrentController_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file CurrentController_codegen_rpt.html
### Build procedure for model: 'CurrentController' aborted due to an error.
Error(s) encountered while building "CurrentController":
### Failed to generate all binary outputs.

Venkatesh Chilapur
Venkatesh Chilapur 2018-8-27
You may want to remove the & from the following path and see if it helps. 'C:\Users\A&A\Desktop\CurrentController_ert_rtw\CurrentController.mk'

Fakhreddin Amirhosseini
I realized this problem can be caused by various reasons.
I managed to solve this problem before here now I'm encountering it again and the problem is somewhere in my C code.
It says that it cannot find the function that I've called in the C file.
F:/somewhere/blah_blah/src/someFile.cpp:18:16:
error: 'closeLines' was not declared in this scope closeLines();
even though I've decelerated it in my C code "someFile.cpp"
extern "C" void closeLines()
{
digitalWrite(CS_Sensor1, 1);
digitalWrite(CS_Sensor2, 1);
digitalWrite(CS_Sensor3, 1);
digitalWrite(CS_Sensor4, 1);
}

hamid hassani
hamid hassani 2021-1-28
The problem is due to the working folder name,
you should modify the name of the folder to be only one word

ha duc
ha duc 2021-9-8
### Generating code into build folder: D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw ### Invoking Target Language Compiler on PID_v1.rtw ### Using System Target File: C:\Program Files\MATLAB\R2018a\rtw\c\ert\ert.tlc ### Loading TLC function libraries ....... ### Initial pass through model to cache user defined code ... ### Caching model source code ........................................................... ### Writing header file PID_v1_types.h ### Writing source file PID_v1.c ### Writing header file PID_v1_private.h . ### Writing header file PID_v1.h ### Writing header file rtwtypes.h ### Writing header file multiword_types.h ### Writing header file rt_nonfinite.h ### Writing source file rt_nonfinite.c . ### Writing header file rtGetInf.h ### Writing source file rtGetInf.c ### Writing header file rtGetNaN.h ### Writing source file rtGetNaN.c ### Writing source file PID_v1_data.c ### Writing header file rtmodel.h . ### Writing source file ert_main.c ### TLC code generation complete. ### Generating TLC interface API. ............... ### Creating data type transition file PID_v1_dt.h ### Evaluating PostCodeGenCommand specified in the model ### Using toolchain: Arduino AVR v1.8.1 | gmake (64-bit Windows) ### 'D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw\PID_v1.mk' is up to date ### Building 'PID_v1': "C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f PID_v1.mk all D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw>cd . D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f PID_v1.mk all ) else ("C:\PROGRA~1\MATLAB\R2018a\bin\win64\gmake" -f PID_v1.mk ) C:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_PWM.dep" -MT"MW_PWM.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=PID_v1 -DNUMST=2 -DNCSTATES=2 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DON_TARGET_WAIT_FOR_START=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_TIMERID=2 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=131 -DMW_SCHEDULERCOUNTER=5 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DEXT_MODE=1 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=PID_v1 -DNUMST=2 -DNCSTATES=2 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -ID:/arduino/May_tro_tho/Tro_tho_v1 -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/shared/svd/include -ID:/arduino/May_tro_tho/src -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/include -ID:/arduino/May_tro_tho/Tro_tho_v1/PID_v1_ert_rtw -IC:/PROGRA~1/MATLAB/R2018a/extern/include -IC:/PROGRA~1/MATLAB/R2018a/simulink/include -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2018a/toolbox/coder/rtiostream/src/utils -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/libraries/Servo/src -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/shared/externalmode_daemon/include -o MW_PWM.o C:/ProgramData/MATLAB/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/src/MW_PWM.cpp gmake: *** No rule to make target `D:/arduino/May_tro_tho/Tro_tho_v1/../src/encoder_arduino.cpp', needed by `encoder_arduino.o'. Stop. D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 D:\arduino\May_tro_tho\Tro_tho_v1\PID_v1_ert_rtw>An_error_occurred_during_the_call_to_make 'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command, operable program or batch file. ### Creating HTML report file PID_v1_codegen_rpt.html
### Build procedure for model: 'PID_v1' aborted due to an error.
Error(s) encountered while building "PID_v1": ### Failed to generate all binary outputs.
i am having similar error. Can i help you explain and tell me how do i fix it. thank you so much!

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by