exit status 1 a function-definition is not allowed here before '{' token

The purpose of this project is to associate different servos with different key presses and have the servos turn completely (180 degrees) upon a key press. I keep getting the error message:

"exit status 1
a function-definition is not allowed here before '{' token"

whenever I try to verify the code. Can anyone see why this error code is appearing? Code is inserted below in this message. Thank you all very much.

void setup() {
#include <Servo.h>
Servo pinky;
Servo ring;
Servo middle;
Servo index;
Servo thumb;
Servo wrist;
char val;
int ppos = 0;
int rpos = 0;
int mpos = 0;
int ipos = 0;
int tpos = 0;
int wpos = 180;
void setup()
{
//Show which servo is connected to which pin
  pinky.attach(6);
  ring.attach(5);
  middle.attach(4);
  index.attach(3);
  thumb.attach(2);
  wrist.attach(6);
//set all servos to starting position
  pinky.write(0);
  ring.write(0);
  middle.write(0);
  index.write(0);
  thumb.write(0);
  wrist.write(180);
  Serial.begin(9600); //start serial output at 9600
  Serial.println("WE WORK!!");
}
void loop()
{
    if (val == 'y') {    
//rotate wrist counter clockwise
      wpos = 0;
      wrist.write(wpos);
    }
    if (val == 'h') {    
//rotate wrist clockwise
      wpos = 200;
      wrist.write(wpos);
    }
    if (val == 'c') {     
//close whole hand
      ppos = 180;
      pinky.write(ppos);
      ring.write(ppos);
      middle.write(ppos);
      index.write(ppos);
      thumb.write(ppos);
    }
    if (val == 'o') {     
//open whole hand
      ppos = 0;
      pinky.write(ppos);
      ring.write(ppos);
      middle.write(ppos);
      index.write(ppos);
      thumb.write(ppos);
    }
  }
}

Two setup()s ???

.

Looks like you picked up an extra line at the beginning:

void setup() {

The first line (which looks like this):

void setup() {

does not belong. Delete it.

You use the value of the variable 'val' but you never give it a value.

You may also want to learn about the switch/case/break/default statement. Some may call this more simply the switch or switch/case statement.

Delta_G:
Looks like you picked up an extra line at the beginning:

void setup() {

vaj4088:
The first line (which looks like this):

void setup() {

does not belong. Delete it.

You use the value of the variable 'val' but you never give it a value.

You may also want to learn about the switch/case/break/default statement. Some may call this more simply the switch or switch/case statement.

Took out the first line (didn't see that it was in there :P) and the code verified. And I'll make sure to the fix the undefined 'val'. Thank you both/all!