譬如
有个a.ino 项目,同文件目录下有a.h、a.cpp 编译时报错:
undefined reference to `setup'
undefined reference to `loop'
报错示例如下
Arduino:1.6.5 (Windows XP), 板:"Arduino Nano, ATmega328"
构建选项已变更,全部重新构建
R:\TEMP\build1720938598067549718.tmp/core.a(main.cpp.o): In function `main':
D:\Program Files\Arduino\arduino1.6.5\hardware\arduino\avr\cores\arduino/main.cpp:40: undefined reference to `setup'
D:\Program Files\Arduino\arduino1.6.5\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
编译有误。
解决方案:避免重名。