Alice counts the times she finds the light on, and ensures that it is always off when she leaves the room. Everyone else turns on the light the first time they find it off, and then never touches it again. This way, between visits of Alice, at most one prisoner will turn on the light, and no prisoner turns it on more than once. Therefore the number of times Alice finds the light on is no more than the number of different prisoners that have entered the room. Each prisoner knows he has been counted once he has turned the light on, since he is the only one who touched the switch since Alice last visited. When Alice counts to n-1, she knows everyone has visited the room.
I wrote a program to simulate this solution. Feel free to check it for bugs (this is the first bit of C++ I've written in about 2yrs). You may note some incomplete functions ... this is still a work in progress. Compiles with Visual C++ 6 (blech) fellow GNU-ers will need to make some minor changes to get it to compile.