Tone library on Mega 2560 r3

Hello, I am new at this arduino thing and i need some help.
I am trying to use the Tone Library on my arduino Mega 2560. the library was instaled correctly but for some reason, while trying to complile or program the arduino with any of the examples I get this error:

C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp: In member function 'void Tone::begin(uint8_t)':
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:121: error: 'bitWrite' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:123: error: 'digitalPinToPort' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:123: error: 'portOutputRegister' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:124: error: 'digitalPinToBitMask' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp: In member function 'void Tone::play(uint16_t, uint32_t)':
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:198: error: 'OUTPUT' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:198: error: 'pinMode' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:294: error: 'bitWrite' was not declared in this scope
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp: In member function 'void Tone::stop()':
C:\Users\Peavey\Desktop\arduino-1.0.3\libraries\Tone\Tone.cpp:361: error: 'digitalWrite' was not declared in this scope

can anyone please help?

you may need to edit the .cpp; I'm having issues with this library as well, but this advice got it to load:

https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation

(scroll down)

you mean the post that says

" #if defined(AVR_ATmega1280) And replaced it with this: #if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)"

I had problems with this library also on the Nano

I did this and it worked.

On the Tone.cpp file, edit where it says:

#include <wiring.h>

and change it to:

#include <Arduino.h>

Hope this fix you the problem.