OpenGL animation flickering.

I ran a program that animates a 2d cube in Opengl. I have used glSwapBuffers and GLUT_DOUBLE in my code but I am still getting a frantic flickering. What am I doing wrong? Also what are some common mistakes beginners make when creating an application that would lead to flickering?
I am using Xcode 4 on Mac OS X Lion and the GLUT and OPENGL libraries.
Thanks for the help, sorry if it’s a dumb question.