1. 程式人生 > >關於OTTO機器人原始碼在Arduino IDE編譯報錯問題解析

關於OTTO機器人原始碼在Arduino IDE編譯報錯問題解析

庫檔案地址:

arduino IDE - 左上角選單欄【檔案】-首選項-專案資料夾位置

F:\Arduino IDE\INS\Arduino\libraries\Otto

錯誤提示資訊:

Arduino:1.6.4 (Windows 8.1), 板:"Arduino Nano, ATmega328"

構建選項已變更,全部重新構建 使用庫 LedMatrix 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\LedMatrix (legacy) 使用庫 BatReader 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\BatReader (legacy) 使用庫 EEPROM 在資料夾: F:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM 使用庫 Servo 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\Servo 使用庫 Oscillator 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\Oscillator (legacy) 使用庫 US 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\US (legacy) 使用庫 Otto 在資料夾: F:\Arduino IDE\INS\Arduino\libraries\Otto (legacy) F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\OTTO_stand.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\OTTO_stand.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix\utility F:\Arduino IDE\INS\Arduino\libraries\LedMatrix\LedMatrix.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\LedMatrix\LedMatrix.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto -IF:\Arduino IDE\INS\Arduino\libraries\BatReader\utility F:\Arduino IDE\INS\Arduino\libraries\BatReader\BatReader.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\BatReader\BatReader.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto F:\Arduino IDE\INS\Arduino\libraries\Servo\src\avr\Servo.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\Servo\avr\Servo.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto F:\Arduino IDE\INS\Arduino\libraries\Servo\src\sam\Servo.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\Servo\sam\Servo.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator\utility F:\Arduino IDE\INS\Arduino\libraries\Oscillator\Oscillator.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\Oscillator\Oscillator.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto -IF:\Arduino IDE\INS\Arduino\libraries\US\utility F:\Arduino IDE\INS\Arduino\libraries\US\US.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\US\US.cpp.o F:\Arduino IDE\INS\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\cores\arduino -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IF:\Arduino IDE\INS\Arduino\libraries\LedMatrix -IF:\Arduino IDE\INS\Arduino\libraries\BatReader -IF:\Arduino IDE\INS\Arduino\hardware\arduino\avr\libraries\EEPROM -IF:\Arduino IDE\INS\Arduino\libraries\Servo\src -IF:\Arduino IDE\INS\Arduino\libraries\Oscillator -IF:\Arduino IDE\INS\Arduino\libraries\US -IF:\Arduino IDE\INS\Arduino\libraries\Otto -IF:\Arduino IDE\INS\Arduino\libraries\Otto\utility F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp -o C:\Users\Administrator\AppData\Local\Temp\build2052363392704674260.tmp\Otto\Otto.cpp.o In file included from F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:10:0: F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.h:98:5: error: 'LedMatrix' does not name a type      LedMatrix ledmatrix ;//LedMatrix ledmatrix涔嬪墠緙哄皯LedMatrix澶存枃浠?      ^F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:

In member function 'void Otto::putAnimationMouth(long unsigned int, int)':F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:677:7: error: 'ledmatrix' was not declared in this scope        ledmatrix.writeFull(getAnimShape(aniMouth,index));【問題所在:Otto庫檔案中缺少#include <LedMatrix.h>一直報錯!只需要找到F:\Arduino IDE\INS\Arduino\libraries\Otto庫檔案-找到Otto.h標頭檔案後新增程式碼即可】
       ^ F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp: In member function 'void Otto::putMouth(long unsigned int, bool)': F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:684:5: error: 'ledmatrix' was not declared in this scope      ledmatrix.writeFull(getMouthShape(mouth));      ^ F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:687:5: error: 'ledmatrix' was not declared in this scope      ledmatrix.writeFull(mouth);      ^ F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp: In member function 'void Otto::clearMouth()': F:\Arduino IDE\INS\Arduino\libraries\Otto\Otto.cpp:694:3: error: 'ledmatrix' was not declared in this scope    ledmatrix.clearMatrix();    ^ 編譯有誤。

問題解決方法:

問題所在:Otto庫檔案中缺少#include <LedMatrix.h>

1.找到F:\Arduino IDE\INS\Arduino\libraries\Otto路徑下的庫檔案存放地址-

2.找到Otto.h標頭檔案後開啟檔案,新增#include <LedMatrix.h>程式碼即可。