在 mac 上编译时未在范围内声明 nullptr

nullptr not declared in scope when compiling on mac

我正在尝试使用“Yet Another PCInt Library”在我的 Arduino mega 2560 上启用引脚更改中断。在 Arduino IDE 中,代码在 windows 上编译良好,但在 mac 上失败了。它给出了一个错误代码:

 nullptr not declared in this scope
 attachInterrupt(pin, (callback)func, nullptr, mode, trigger_now);
                      ^

我怎样才能让它在 arduino IDE 的 OS X 上编译?

nullptr被引入到C++11标准中,在任何早期的标准中都不存在。
我最好的猜测是您的 arduino IDE 未配置为针对 C++11 标准进行编译。

您可能希望确保 avr-g++ 的标志为 --std=c++11 或更高。