-1

我正在尝试使用Arduino Uno将代码上传到 ATtiny 2313,但出现错误:

In file included from /usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:44:0,
                 from /usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/delay.h:37,
                 from /usr/share/arduino/hardware/tiny/cores/tiny/wiring_private.h:32,
                 from /usr/share/arduino/hardware/tiny/cores/tiny/WInterrupts.c:37:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.7.2/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token

即使是在空白草图上。

平台:

  • IDE版本:1.03
  • Arduino R3
  • 操作系统:Ubuntu 13.04(Raring Ringtail)

我该如何解决这个问题?

4

1 回答 1

0

诸如此类的标头中的编译失败可能是由意外的宏结果引起的。我的 Arduino IDE 1.03 安装只使用 GCC 4.3.2,所以在 math.h 中看不到你的第 426 行。编译器的版本可能是您的问题。Arduino 附带 4.3.2,但您已经安装了前沿 4.7.2 GCC

您可以尝试通过强制标头包含的顺序来解决此错误。放

#include <math.h>

在源文件的最顶部。这将导致它在其他文件之前被扩展,并可能消除错误。改组文件顺序以消除依赖问题不是最佳实践。

如果要修复,请查看第 426 行。在文件中查找任何看起来像宏定义的文本。您可能会在小标题中找到与其他内核不同的东西。

于 2013-06-05T07:23:21.857 回答