为什么我收到此错误?

时间:2016-07-22 05:20:39

标签: scope arduino undeclared-identifier

Arduino:1.6.9(Windows 10),董事会:" Arduino Mega ADK"

包含在C:\ Users \ Disheet \ Downloads \ humanoid_1 \ humanoid_1.ino:1:0:

中的文件

C:\ Users \ Disheet \ Documents \ Arduino \ libraries \ ax12v2 / ax12.h:66:23:错误:冲突声明' typedef unsigned char boolean'

typedef unsigned char boolean;

                   ^

在sketch \ humanoid_1.ino.cpp中包含的文件中:1:0:

C:\ Program Files(x86)\ Arduino \ hardware \ arduino \ avr \ cores \ arduino / Arduino.h:117:14:错误:' boolean'有一个先前的声明为' typedef bool boolean'

typedef bool boolean;

          ^

C:\ Users \ Disheet \ Downloads \ humanoid_1 \ humanoid_1.ino:在功能' void setup()':

humanoid_1:5:错误:' SetPosition'未在此范围内声明

SetPosition(1,0); //// id,posiotin 0-1023

              ^

C:\ Users \ Disheet \ Downloads \ humanoid_1 \ humanoid_1.ino:在函数' void loop()':

humanoid_1:13:错误:' SetPosition'未在此范围内声明

SETPOSITION(1512);

                ^

为" ax12.h"找到了多个库。  使用:C:\ Users \ Disheet \ Documents \ Arduino \ libraries \ ax12v2  未使用:C:\ Users \ Disheet \ Documents \ Arduino \ libraries \ Bioloid 退出状态1 ' SETPOSITION'未在此范围内声明

此报告将提供更多信息 "在编译期间显示详细输出" 文件中启用了选项 - >偏好。

1 个答案:

答案 0 :(得分:1)

您需要在库中找到typedef unsigned char boolean;并更改它以匹配Arduino.h中的版本。

boolean已经是Arduino.h中的typedef,它是bool,而不是unsigned char

在AX12库中搜索: https://github.com/7Robot/Arduino/blob/master/AX12/libraries/ax12/ax12.h#L66

并将其更改为typedef bool boolean;

此前已更新,因此您的IDE版本比AX12库更新。

相关问题