undefined reference to `SoftwareServo::attach(int)'

Hi all

I hope somebody can help me with this. I tried compiling this code

#include "SoftwareServo.h"

SoftwareServo myservo;  // create servo object to control a servo 

int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 

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

void loop() 
{ 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 

  SoftwareServo::refresh();

But i get the follwing errors:

sketch_feb14a.cpp.o: In function `setup':
/Arduino/sketch_feb14a.ino:10: undefined reference to `SoftwareServo::attach(int)'
sketch_feb14a.cpp.o: In function `loop':
/Arduino/sketch_feb14a.ino:17: undefined reference to `SoftwareServo::write(int)'
/Arduino/sketch_feb14a.ino:21: undefined reference to `SoftwareServo::refresh()'
sketch_feb14a.cpp.o: In function `__static_initialization_and_destruction_0':
/Arduino/sketch_feb14a.ino:20: undefined reference to `SoftwareServo::SoftwareServo()'
collect2: error: ld returned 1 exit status

In softwareservo.h I changed the wprogram.h to #include <Arduino.h>.

It should be noted that i did not have my arduino connected to the computer but only tried compiling it on the computer.
Any help would be appriciated.

Where did you put the SoftwareServo library? Is it in the same folder as the sketch or in the libraries folder?

It looks, since you are getting linker errors, not compiler errors, like you only have the header file (SoftwareServo.h). Do you, in fact, have the source file (SoftwareServo.cpp), too?

It works now.

I had the header file in the same dir as the project file. I changed the #include <SoftwareServo.h> to #include "SoftwareServo.h".
I copied the cpp file to the same directory and changed the same in this file and now it works. This i hadn't done before.

Thanks to both of you. I am not that good at cpp.