Error from basic Servo Sweep example

Hi, i have now got my ahead around LED, AVR and some other bits and pieces and need to to get some servos working. I started by trying the basic sweep example as provided with Arduino and i get this error on compiling, even without a servo connected (I get the same when the servo is connected) and wondered if it was a simple issue like a library missing that i can just download etc. Thank you,as usual for your time.

C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp: In member function 'uint8_t Servo::attach(int)':
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:28: error: 'digitalWrite' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:29: error: 'OUTPUT' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:29: error: 'pinMode' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp: In member function 'void Servo::write(int)':
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:52: error: 'clockCyclesPerMicrosecond' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp: In static member function 'static void Servo::refresh()':
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:74: error: 'millis' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:107: error: 'digitalWrite' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:109: error: 'TCNT0' was not declared in this scope
C:\Users\jimpe_000\Documents\Arduino\libraries\Servo\Servo.cpp:124: error: 'digitalWrite' was not declared in this scope

Im using V 1.0.5.r2 of Arduino and this is the example sketch.

// Sweep
// by BARRAGAN http://barraganstudio.com
// This example code is in the public domain.

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

I hope thats enough for someone to spot a problem.

Which Arduino are you using and does it match the board selected in the IDE ?

Try the traditional IT solution. Delete and reinstall the Arduino IDE.

...R

The IDE include the servo library. You shouldn't need to install it in your sketch folder. Delete that one and try again.

Im using the UNO R3 and that board is selected. I haven't put any new libraries in so it is what arrived with IDE, i haven't tried uninstalling etc as i don't want to lose any sketches r hardware ;libraries that i have already installed, will it overwrite everything or leave the stuff that is not in the standard build?

You shouldn't have a folder named "Servo" in your user's sketch folder. Just delete the folder named "servo" that was in the file path you posted. The one installed by the IDE is in C:\Program Files so that will not be affected.. If you're still not sure what I mean then
expand you Users\lbraries window's explorer view and take a screenshot of you file structure and post that for us to look at.

Where did you install the IDE? Where is your sketch directory?

On my computer, the IDE is installed in:
C:\Users\PaulS\Documents\arduino_1.0.5
and my sketch folder is
C:\Users\PaulS\Documents\Arduino

If you followed any kind of similar scheme, it means that you have a copy of the Servo library in your libraries folder that conflicts with the one that comes with the IDE. If you tried to install the IDE in the sketch folder, that isn't going to work.

Ok, it was a mix of an incomplete library in the wrong place and duplicated. I have no idea how that happened but it now seems to be sorted. Thank you all very much for your help. It is much appreciated.

I think he used the automated install because I think it puts the IDE in C:\Program Files[Arduino]
If his IDE is in c:\My Documents\ maybe that explains the compile errors.

The IDE is in program files and sketches etc in my documents but the library i had in the IDE location was missing files somehow, copied from my docs to the IDE directory and all seems well.