c++ - 在 mac 上编译时,nullptr 未在范围内声明

标签 c++ arduino interrupt nullptr

我正在尝试使用“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/

相关文章:

c++ - 在 C++ 中重新定义头文件之间的虚函数

c++ - int 的最大值

assembly - 软件中断 `int`指令可以用来触发硬件中断处理程序吗?

linux - Perl:如何添加中断处理程序,以便可以通过 system() 控制 mpirun 执行的代码?

c++ - 在网页上托管 C++ 桌面应用程序

c++ - 为什么在全局范围内使用 “extern int a”似乎不可行?

android - 通过蓝牙将字符串发送到 Arduino 上的 Android 设备

c - (c/c++) 日/月/年 hh :ii:ss to unix timestamp

android - ADK 与谷歌 Nexus 4

interrupt - Ada - pragma Attach_Handler() 是否可以将处理程序附加到 System.Priority'Last 优先级?