Enum as a function parameter

Hi everyone. I'm getting compilation error for this code:
enum connectionStates
{
csDoNothing,
csDisconnected,
csConnecting,
csConnected,
csReadyToSend,
csReceiving,
csReceived,
csFailed
};
connectionStates conState = csConnecting; //????????? ??????????
void setState(connectionStates s)
{
conState = s;
Serial.print("con state:"); Serial.println(s);
}

it says:

GPRS:-1: error: variable or field 'setState' declared void
GPRS:-1: error: 'connectionStates' was not declared in this scope

Anyone knows why? Thanks ahead.

That looks like anIDE bug (like the reference parameter bug)
Can you post all your code, or the smallest sketch that exhibits the problem?

You can try this:

enum abc
{
a,
b,
c
};

void as(abc a)
{
}

void setup()
{
}

void loop()
{
}

Creating a new tab, with a .h extension, moving the enum declaration to that file, and including that file in the sketch makes the problem go away.

PaulS:
Creating a new tab, with a .h extension, moving the enum declaration to that file, and including that file in the sketch makes the problem go away.

Thanks! That helped.