我正在尝试使用“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);
^
如何在 OS X 上的 arduino IDE 中进行编译?
最佳答案
nullptr被引入到C++11标准中,并且在任何早期标准中都不存在。
我最好的猜测是您的 arduino IDE 未配置为根据 C++11 标准进行编译。
您可能需要确保为 avr-g++
赋予 --std=c++11
或更高标志。
关于c++ - 在 mac 上编译时,nullptr 未在范围内声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37822826/