Arduino的:错误:“ABS”在此范围中未声明 [英] Arduino: error: 'abs' was not declared in this scope

查看:1397
本文介绍了Arduino的:错误:“ABS”在此范围中未声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Arduino库需要的ABS()函数:

I'm working on an arduino library needing the abs() function:

#include <math.h>
normTransFreq1 = abs(1.0);

错误:ABS在此范围中未声明

Error: 'abs' was not declared in this scope

由于文件math.h 已经包含在CPP,我完全不知道该如何解决这个问题。一个新的Arduino 1.5.2的安装并没有帮助。

As math.h is already included in the cpp I'm entirely unsure how to fix this problem. A new install of arduino 1.5.2 didn't help.

推荐答案

刚刚找到了解决办法:

无需为库包含math.h中。相反,应该Arduino.h加入以下的头文件中包括:

Including math.h is not needed for the library. Instead, Arduino.h should be included by adding the following to the header file:

#if ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

这篇关于Arduino的:错误:“ABS”在此范围中未声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆