C++ graphics XCB error – ubuntu 12.04

The code given below complies properly but the output of program blinks and ends with error.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>
    #include<graphics.h>
    using namespace std;
    int main()
    {
      int gd=DETECT,gm;
      int i,x,y;
      initgraph(&gd,&gm,NULL);
      line(0,0,640,0);
      line(0,0,0,480);
      line(639,0,639,480);
      line(639,479,0,479);
      for(i=0;i<=1000;i++)
     {
        x=rand()%639;
        y=rand()%480;
        putpixel(x,y,15);
      }
      getch();
      closegraph();
    }

And the error which I got is:

   [xcb] Unknown sequence number while processing queue
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not   been  called
    [xcb] Aborting, sorry about that.
    star: ../../src/xcb_io.c:274: poll_for_event:  Assertion                    !xcb_xlib_threads_sequence_lost' failed.
    [xcb] Unknown sequence number while processing queue
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
    [xcb] Aborting, sorry about that.
    star: ../../src/xcb_io.c:274: poll_for_event: Assertion       `!xcb_xlib_threads_sequence_lost' failed.
        Aborted (core dumped)


Please Help!
Thanks in advance.
Last edited on
Topic archived. No new replies allowed.