-1

It keeps on giving me the error:

Error compiling for board Arduino/Genuino Mega or Mega 2560. 

Other sketches work fine, but this one will not compile, even though I have all the libraries.

Here is the link for the code: https://drive.google.com/open?id=0B3R5NMiGZ3RPSk9WS0Y1amtEYms

The full error:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':

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

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

d:/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: error: ld returned 1 exit status

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

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
  • Thank you everyone. all i had to do was get rid of the tone() function. – Rowan Radosav - McRae Jul 8 '17 at 0:57
  • ps. is there a way i could still use it? – Rowan Radosav - McRae Jul 8 '17 at 0:57
  • Link is now dead, so your question is not of much use to others. This is why it is always best to include the code in the question and not a link. If the solution was to remove the tone() function, why don't you post that as an answer, explaining why that helped fix your code? – Greenonline May 12 at 16:19
  • @Greenonline This thread is almost 2 years old... – Rowan Radosav - McRae May 13 at 4:33
  • There are questions on Electrical Engineering that are 10 years old which are still useful ... I came across your question whilst looking for a solution to an issue that I'm having, but it wasn't as useful as it might have been. That's all I'm saying... :-) – Greenonline May 13 at 4:36
3

There are a number of issues with your code besides the actual error:

  • You are dividing an unsigned long by an integer which results in an unsigned long, then rounding it. Makes no sense.
  • You are assigning (I assume - without seeing your code I can't be sure) long constants (eg 0xFFE01F) to an integer - which overflows and whinges.

However your main problem is that you have two interrupt service routines (ISRs) for the same interrupt (vector 7). What that interrupt is I can't say, since it is different on different chips, and you don't seem able to make your mind up if you're using an Uno or a Mega (you tagged your question both for some reason). So you will have to change code and/or libraries to use different interrupts or combine the two together to use just one ISR.

0

I can't see you code, but my guess is that you are passing an unsigned value into round().

millis() returns an unsigned long, this means it can never be negative, so if you test millis() >= 0 it will always be true. That is your issue.

Write you own round function that doesn't check its greater than 0.

  • 1
    I don't think that's the error, it's just a warning. The real problem is in: (.text+0x0): multiple definition of `__vector_7' (link error) – Michel Keijzers Jul 7 '17 at 9:17
0

just some warnings about generally unsafe/unsound code pieces.

the major issue (potentially unresolvable) is the vector-7 error. you should look into the datasheet to see what interrupt vector it is referring to first. There are more than one of such ISRs declared in your code.

-1

I searched but couldn't find an answer, then I suddenly released my Arduino external power caused this problem. When I shut down the external power I could install it in my device. I hope it works for your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.