Using the OpenCV 2.3.1 binaries (as mentioned in my previous post) did not give me the expected result as the CascadeClassifier class was always returning <incomplete type> and the application was crashing.
So I decided to build OpenCV on my system. I followed the instructions given at http://karytech.blogspot.com/2011/09/opencv-231-on-ubuntu-1010-or-later.html with a small change that I also enabled V4L as I needed the support to capture images from my usb webcam.
I then compiled the program using CMake, and everything started working correctly. I compiled and ran the FaceDetect sample program from http://opencv.itseez.com/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier