错误& quot;' timer0_pin_port'"的原因是什么?和&“' _vector_13'&"? [英] What is the cause of the errors "'timer0_pin_port'" and "'_vector_13'"?

查看:100
本文介绍了错误& quot;' timer0_pin_port'"的原因是什么?和&“' _vector_13'&"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include "IRremote.h"

int receiver = 11;

IRrecv irReceiver(receiver);
decode_results results;

void setup() {
  // put your setup code here, to run once:
pinMode(buttonPinA, INPUT_PULLUP);
pinMode(buttonPinB, INPUT_PULLUP);
pinMode(buttonPinC, INPUT_PULLUP);
pinMode(buttonPinD, INPUT_PULLUP);
irReceiver.enableIRIn();
}

错误消息是:

Tone.cpp.o(插件的符号):在"timer0_pin_port"函数中:

(.text + 0x0):"__ vector_13"的多个定义

(.text+0x0): multiple definition of `__vector_13'

libraries \ IRremote \ IRremote.cpp.o(插件的符号):(.text + 0x0):首先在这里定义

libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here

c:/程序文件(x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe:禁用松弛:不适用于多种定义

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

collect2.exe:错误:ld返回1个退出状态

collect2.exe: error: ld returned 1 exit status

退出状态1 为板Arduino/Genuino Mega或Mega编译时出错2560.

exit status 1 Error compiling for board Arduino/Genuino Mega or Mega 2560.

我最近发现,音调"和"IRremote"命令使用此处的timer2.我不知道什么是timer2以及如何更改它.

I have recently discovered that "tone" and "IRremote" commands use timer2 from here. I am unaware of what timer2 really is and how to change it.

推荐答案

此错误是链接的时间问题.两段库代码都声明了具有相同名称的内容(在这种情况下,这是一个计时器).

This error is a link-time issue. Two pieces of library code have both declared something with the same name (in this case it's a timer).

因此编译就可以了,现在链接程序将已编译的输出打包到可执行文件中.每次您看到诸如 error:ld return ... 之类的错误消息时,都知道这是链接问题,而不是语法问题.任何 ld 都是链接器("ld"是链接器程序的名称).

So the compilation was all OK, and now the linker is taking the compiled output and is wrapping it into an executable. Every time you see an error message like error: ld returned ..., know it's a link problem, and not a syntax issue. Anything ld is the linker ("ld" is the name of the linker program).

如此处所述:

https://forum.arduino.cc/index.php?topic = 120955.msg2613823#msg2613823

编辑头文件IRRemote.h并更改库使用的计时器中断:

Edit the header file IRRemote.h and change which timer interrupt the library uses:

更改选择:

#define IR_USE_TIMER1   // tx = pin 9
// #define IR_USE_TIMER2     // tx = pin 3

例如:

// #define IR_USE_TIMER1   // tx = pin 9
#define IR_USE_TIMER2     // tx = pin 3

这篇关于错误& quot;' timer0_pin_port'"的原因是什么?和&“' _vector_13'&"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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