"Gtk-warning: cannot open display"


I have copied opencv programs into sd card and put it on my beagleboard-xm ubuntu and ran it as root on minicom. I have already installed opencv,libwebcam,etc and compiled a sample c program-hello.c It works well.
But when I compiled an opencv program to display an image it shows “Gtk-warning: cannot open display”.
Can anyone please find a solution for this.
After solving this problem only I can go forward. Awaiting your response regarding this.



#export DISPLAY=:0

I have done export DISPLAY=.0. Still the error exists.
I have a doubt isn’t it possible to display the execution of beagleboard program using usb-serial cable on my laptop???
Or is it necessary to use HDMI to DVI-D cable and connect to a monitor to execute an opencv program??? Pls help me in this regard.
Awaiting your valuable response.


Minicom (and serial terminals in general) have no means to display graphics. You need an X server for that. There are at least two ways to do that: run the X server on BB itself, displaying to its HDMI; or use the X server on your host machine by connecting to the BB with “ssh -X” instead of over serial. X protocol will happily work over a network connection.

Thank you very much for your reply…
Actually I am completely unaware of that knowlwdge.
If it is not a big deal…
What are the steps steps involved in ssh with x11 forwarding on BB with laptop?
Or kindly plz provide me any online links for the same.
Awating ur valuable response.

Thanks & Regards,

Depending on how you have your BB connected to the network, it might be as simple as opening a terminal on your PC and typing “ssh -X root@beaglebone.local”. If that doesn’t work, you may have to play with IP addresses or hostnames and such.