【问题标题】:Error compiling for board Arduino/Genuino Mega or Mega 2560 with FastLED library使用 FastLED 库为板 Arduino/Genuino Mega 或 Mega 2560 编译时出错
【发布时间】:2020-04-06 10:40:12
【问题描述】:

我开始了一个pixel lamp by Heliox (cults3d link)french youtube video of the project 的 3d 项目,但我遇到了编译问题,我是初学者。
我已经下载了 FastLED 库并拥有文件pixellamp.h 这里也是项目创建者提供的原始代码文件夹的link 该错误可能是因为我需要更新 Arduino IDE。 如果他们需要更多信息,请问我。

感谢您的帮助

PS:我已经给项目创建者发了消息,等待回复


In file included from C:\Users\Mael\Documents\Arduino\Lampe\Pixelamp\pixelamp\pixelamp.ino:7:0:

C:\Users\Mael\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.003

 #    pragma message "FastLED version 3.003.003"

                     ^

In file included from C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/fastled_avr.h:6:0,

                 from C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms.h:39,

                 from C:\Users\Mael\Documents\Arduino\libraries\FastLED/FastLED.h:52,

                 from C:\Users\Mael\Documents\Arduino\Lampe\Pixelamp\pixelamp\pixelamp.ino:7:

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h: In static member function 'static void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::showRGBInternal(PixelController<RGB_ORDER>&)':

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:409:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:410:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:411:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:425:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:426:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:427:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:444:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 4: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:445:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 3: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:326:24: error: expected primary-expression before '__attribute__'

 #define FL_FALLTHROUGH __attribute__ ((fallthrough));

                        ^

C:\Users\Mael\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:446:55: note: in expansion of macro 'FL_FALLTHROUGH'

      case 2: _D2(0) LO1 _D3(0) HI1 _D1(1) QLO2(b0,0)  FL_FALLTHROUGH

                                                       ^

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

【问题讨论】:

    标签: arduino compilation led


    【解决方案1】:

    根据谷歌结果是因为它需要 AVR GCC 7.x.x(可能只是一个错误)

    因此,Arduino IDE 中的解决方案基本上是将 FastLED 库降级到版本 3.3.2,因为该库正在工作,也是 Arduino IDE 的最新版本(草图 -> 包含库 -> 管理库 -> 搜索:FastLED 并选择 3.3。 2)。如果是通过其他方式安装的,则应先删除该版本。

    编辑:但我刚刚将 FastLED 更新到 3.3.3 并且它运行良好,也许他们已经修复了它。

    对于 PlatformIO 用户,可以将工具链更改为 GCC 7 版本

    platform_packages =
      ; use GCC AVR 7.3.0+
      toolchain-atmelavr@>=1.70300.0
    

    PlatformIO 的另一种方法是强制使用旧版本的 FastLED 库:

    lib_deps =
      FastLED@3.3.2
    

    【讨论】: