expected initializer before 'void'

I always get this when I'm trying to make the traffic light from makeuseof.com
plz, help. My code is here:

int red = 10;
int yellow = 9;
int green = 8;

void setup()
// put your setup code here, to run once:
void setup(){
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
changeLights();
delay(15000);
}

void changeLights(){
// green off, yellow on for 3 seconds
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(3000);

// turn off yellow, then turn red on for 5 seconds
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
delay(5000);

// red and yellow on for 2 seconds (red is already on though)
digitalWrite(yellow, HIGH);
delay(2000);

// turn off red and yellow, then turn on green
digitalWrite(yellow, LOW);
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
delay(3000);
}
}

What is the error?

In looking at your code, I suspect that the void setup() you are declaring the function, but you are missing the semicolon. Also, you should not need to prototype loop or setup. Remove the void setup that is just above the setup function.

void setup()
  // put your setup code here, to run once:
 void setup(){

Oops

Please remember to use code tags when posting code

Read "How To Use This Forum"

This is what happens when you do not

expected initializer before ... is the pathetic way the IDE tells you that the number of { does not equal the number of }, or you are missing a semicolon

if you highlight the { in void setup, the IDE shows you its mate } just below
if you highlight the last } the IDE can not show you its mate, because there is no mate to it.

ie an extra } at the end

It helps if you format your code , then these are easier to spot

It is NOT the IDE, it is the compiler. And it is NOT pathetic, it is the same error you will get from any c/c++ compiler. It makes perfect sense, and is very clear, if you take the time to understand the language, and how it is defined. Besides, the error message give the EXACT line number, and character position at which it flagged the error. How much more specific can it possibly get?

Regards,
Ray L.

How much more specific can it possibly get?

Well, it could prefix the error message with "Hey, stupid...". 8)