代码出现如下错误:
Arduino:1.8.13 (Windows 10), 开发板:"Arduino Uno"
libraries\Keypad\Key.cpp.o (symbol from plugin): In function `Key::Key()':
(.text+0x0): multiple definition of `Key::Key()'
sketch\Key.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Key.cpp.o (symbol from plugin): In function `Key::Key()':
(.text+0x0): multiple definition of `Key::Key()'
sketch\Key.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Key.cpp.o (symbol from plugin): In function `Key::Key()':
(.text+0x0): multiple definition of `Key::Key(char)'
sketch\Key.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Key.cpp.o (symbol from plugin): In function `Key::Key()':
(.text+0x0): multiple definition of `Key::Key(char)'
sketch\Key.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Key.cpp.o (symbol from plugin): In function `Key::Key()':
(.text+0x0): multiple definition of `Key::key_update(char, KeyState, bool)'
sketch\Key.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::begin(char*)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::scanKeys()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::isPressed(char)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::findInList(char)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::findInList(int)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::getState()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::keyStateChanged()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::numKeys()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::setDebounceTime(unsigned int)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::setHoldTime(unsigned int)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::addEventListener(void (*)(char))'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::transitionTo(unsigned char, KeyState)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::nextKeyState(unsigned char, bool)'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::updateList()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::getKeys()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::getKey()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Keypad\Keypad.cpp.o (symbol from plugin): In function `Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `Keypad::waitForKey()'
sketch\Keypad.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
为开发板 Arduino Uno 编译时出错。
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。