redefinition of 'void setup()'

int R = 12;
int G = 11;
int B = 10;

void setup() {
  pinMode(R, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(B, OUTPUT);
}

void loop() {
  if (pos == 45) {
    digitalWrite(B , 1);

  } else {
    digitalWrite(B, 0);
  }
  if (pos == 90) {
    digitalWrite(G, 1);

  } else {
    digitalWrite (G, 0);
  }
  if (pos == 180) {
    digitalWrite(R, 1);
  } else {
    digitalWrite(R, 0);
  }
}

at the void setup() it errors saying redefinition of ‘void setup()’ Why please tell me

here is my other tab

[/code]
#include <Servo.h>
Servo myservo;
int pos = 0;

void setup() {
myservo.attach(9);
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
}
}
[/code]

I do not get that error with the code you posted.

I do get an error that 'pos' has not been declared.

How many tabs have you got open in the IDE ?

If more than one then what is in them ?