Interfacing of usb camera to bbb

I am using logitech c100 camera to implement a basic capture program using opencv functions
I’ve used the code to capture an image from the Prof.Derek Molloy’s tutorial
However when I run the program in vi editor…I get the following error:
VIDIOC_QUERYMENU : Invalid argument

I tired changing the resolution and also by providing sufficient current, but still I get the same error
Could anyone help to sort this out?