Anytime you have a linker (ld) error like this, you need to link against the library that contains the symbols.
In this case, the OpenGL framework. Add it to your Xcode project, or if you're compiling from the shell add "-framework OpenGL".
Similarly you need "-framework GLUT" for GLUT stuff, and that depends on Objective-C internally so you also need -lobjc (or -framework Cocoa).