Pages: [1]   Go Down
Author Topic: Conflicting Libraries  (Read 1790 times)
0 Members and 1 Guest are viewing this topic.
Guelph, ON
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

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.

Thanks!
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just searched for vector in the libraries and it is not there.  Do you mind posting the error you are getting?  Maybe it will help clarify things.
Logged

Guelph, ON
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply,

I'm at work so I don't have the exact error, but it is almost identical to the following:
Code:
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 (?).

Thanks again.
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Code:
#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
Code:
#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'

This post in the forums might contain your solution if you are not using interrupts with the Ping sensor. http://arduino.cc/forum/index.php/topic,106043.msg960630.html#msg960630
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 433
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it's happen the same things to me ...

there was two libraries in conflict because was used the same pin ...

maybe you can try to change the pin ...

gnux
Logged

Guelph, ON
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again,

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):
Code:
/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?
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, they use the same Timer.

You might want to look at the new ToneAC library here on the forum - http://arduino.cc/forum/index.php/topic,142097.0.html

It seems to use Timer 1, rather than Timer 2, this avoiding the conflict with the. Servo library that the original Tone library has.
Logged

Toledo, OH
Offline Offline
God Member
*****
Karma: 36
Posts: 510
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again,

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):
Code:
/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?

See the following post:

http://forum.arduino.cc/index.php?topic=106043.msg1312639.html#msg1312639

Tim
Logged

Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Pages: [1]   Go Up
Jump to: