invalid use of non-static member function

Although I am new, I have been studying a programming arduino a lot before.

anyway, there's this book called 'Arduino Robot Bonanza', and there is a code for the teachbot at page 91. The problem is, the error message says 'invalid use of non-static member function'

Anyone know the problem?

The code is

#include <Servo.h>
Servo servoLeft;      //define left servo
Servo servoRight;     //define right servo

void setup() {
  forward();
  delay(2000);
  reverse();
  delay(2000);
  turnRight();
  delay(2000);
  turnLeft();
  delay(2000);
  stopRobot();
  delay(2000);
}

void forward() {
  reAttach();
  servoLeft.write(0);
  servoRight.write(180);
}

void reverse() {
  reAttach();
  servoLeft.write(180);
  servoRight.write(0);
}

void turnRight() {
  reAttach();
  servoLeft.write(180);
  servoRight.write(180);
}

void turnLeft() {
  reAttach();
  servoLeft.write(0);
  servoRight.write(0);
}

void stopRobot() {
  servoLeft.detach;
  servoRight.detach;
}

void reAttach() {
  if(!servoLeft.attached())
    servoLeft.attach(9);
  if(!servoRight.attached())
    servoRight.attach(10);  
}

the servoRight.detach in void stopRobot is generating the problem.

I think I did. Thanks for your help Delta_G

for detachment and reattachment of the servos is for the 'teachbot' as in the Arduino Robot Bonanza book.
So really is because a servo wouldn't accidentally operate(this happened before). For example, a servo that goes more than 1500us(90 degrees) wouldn't fully stop, as so in the book.

What I'm trying to say is that the servo, an r/c kind, might just stop at 92 or 109 or something like that.

detaching the servo can stop the arm thingy at 89 or 91 or really a 90.

Delta_G:
I still don't understand how detaching changes where the servo is. When you write servo.write(90) then the servo goes to 90 degrees and stops. If it only goes to 89 then you need to calibrate, not detach. detaching isn't going to make it move.

Or are these continuous rotation servos? That's something you might mention. That might change how you'd use them. But usually there is a value you can write that stops those.

These R/C servos maybe are continuous. I don't really know for sure, but it's really in the book. If you are asking me, I have not too much of an idea of this reattaching and detaching. But I know for sure that the wheels in this bot can accidentally change the servos and steer them in the wrong direction or so.

If you're still not sure, you should check the book 'Arduino Robot Bonanza'. Maybe you can find ome stuff or two.

09999:
If you're still not sure, you should check the book 'Arduino Robot Bonanza'. Maybe you can find ome stuff or two.

Most us will not have that book. I'd never even heard of it before you mentioned it. And I'm not planning on spending 20 quid on a book just to help you. So you have provide more detail not tell people trying help you to "check the book".

Detaching a standard servo removes all control from it and that means that any pressure applied to the arm can move it so it ends up in the wrong place. While it is still attached it will stay where it was commanded.

OTOH detaching a continuous servo will generally cause it to stop rotating. That's very different behaviour. The code you posted looks like it is intended for use with continuous servos.

So if you really don't know what sort of servo you're dealing with then there isn't much hope.

Steve