I have found similar questions to this, and I understand (sort of) what the solution is, but was hoping someone might know a bit more about Arduino libraries to help me out.
I am trying to use both the Servo and Tone libraries in a project. They are conflicting, in particular through the use of vector 11. I think that I have to either change, or rename, this 'vector' but don't know how to identify a vector within the library '.h' files.
Any help to point me in the right direction would be greatly appreciated.
I'm at work so I don't have the exact error, but it is almost identical to the following:
core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files (x86)\arduino-1.0.1\hardware\arduino\cores\arduino/Tone.cpp:523: multiple definition of `__vector_7'
NewPing\NewPing.cpp.o:C:\Program Files (x86)\arduino-1.0.1\libraries\NewPing/NewPing.cpp:214: first defined here
I also tried searching the libraries for "vector" with no success, my guess is that it is referring to a variable being used within the library (?).
I grepped (searched) every single file in the Arduino 1.0.1 software download and the only results were .o files that contained __vector_7.
Then I checked out line 523 in Tone.cpp and found the definition for an ISR called ISR(TIMER2_COMPA_vect).
grepping Tone.cpp again I found #define TIMER2_COMPA_vect TIMER2_COMP_vect
grepping all files for TIMER2_COMP_vect resulted in 23 files with names like iom???.h that contained #define TIMER2_COMP_vect _VECTOR(#)
where # = 3, 4, 9, and 10. But there were no 7's.
Switching tactics I googled Tone.cpp:523: multiple definition of `__vector_7'
I should have been more clear. The error I posted there was almost what I was experiencing. The following is the actual error (the only difference is the vector and libraries involved):
/tmp/build5446.tmp/Tone/Tone.cpp.o: In function `__vector_11':
/Users/oli/Documents/Arduino/libraries/Tone/Tone.cpp:438: multiple definition of `__vector_11'
/tmp/build5446.tmp/Servo/Servo.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/Servo.cpp:103: first defined here
I have googled some more and found that the Tone and Servo libraries are using the same timer on the Uno, I think these are necessary for both modules, and don't know if I can change them.
I should have been more clear. The error I posted there was almost what I was experiencing. The following is the actual error (the only difference is the vector and libraries involved):
/tmp/build5446.tmp/Tone/Tone.cpp.o: In function `__vector_11':
/Users/oli/Documents/Arduino/libraries/Tone/Tone.cpp:438: multiple definition of `__vector_11'
/tmp/build5446.tmp/Servo/Servo.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/Servo/Servo.cpp:103: first defined here
I have googled some more and found that the Tone and Servo libraries are using the same timer on the Uno, I think these are necessary for both modules, and don't know if I can change them.
Any thoughts?
I've had a problem with using "tone" function and NewPing (I'm using for sonar).
This was due to the issue with timers.
Just replaced the first with "NewTone" library which resolved this conflict, but now this NewTone.h
is in conflict with Servo.h
error message:
In function NewTone(unsigned char, unsigned long, unsigned long)': (.text+0x0): multiple definition of __vector_17'
libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
Error compiling for board Arduino/Genuino Mega or Mega 2560.