Function returning class-object: “error: … does not name a type”

Sorry for such a newbie question. But I searched for more than two hours and could not find a solution.

In an Arduino sketch I want to use a class (or a struct) for returning of a set of values. But the compiler always says “error: ‘LEDs’ does not name a type”. The error message means the occurrence of LEDs as the return type of getLEDs().

I have got the latest Arduino IDE (1.0.5) on a Mac with attached Arduino UNO. I tried it several times: Closed the IDE, reopened it, copied this code into it. It shows: “error: ‘LEDs’ does not name a type”. Btw: Other sketches work.

    class LEDs {
        int brightness1;
        int brightness2;
        int brightness3;

    LEDs getLEDs(){
        LEDs led;
        led.brightness1 = 255;
        led.brightness2 = 255;
        led.brightness3 = 255;
        return led;  

    void setup() {                

    void loop(){
        LEDs a = getLEDs();

Its a common one this:

Wow! Now I think my question was not so stupid. Your answer was from the from the deepest depths of Arduino. With the throws() it works great. Thanks!

Thanks, I try and put as much as I can into my FAQ's. Great to see that people can understand what I wrote :) The throw() syntax does make life far easier than re-writing a prototype every time a function changes.

Good luck with your project.