linux - Error initializing XGCValues -
I was following the tutorial, stuck here a little:
this code does not compile And error message is
c: 35: error: invalid initialer
I'm not sure what is wrong in the line
< Pre> xgc value value = cabbatta | JOINBEVEL;
Actually, I copied it from the tutorial. I have the full code here:
#include & lt; Stdio.h & gt; # Include & lt; X11 / Xlib.h & gt; # Include & lt; Unistd.h & gt; Int main () {display * display = XOpenDisplay (NULL); Int scr = DefaultScreen (display); Window root_windows = root windows (display, scrap); Unsigned int width = display width (display, scr) / 3; Unsigned int height = display high (display, scr) / 3; Unsigned int border = 2; Window my_win = XCreateSimpleWindow (display, root_window, 0,0, width, height, border, black pixels (display, scorpion), white pixel (display, scourb)); GC GC; XGC value value = CAPBATTA | JOINBEVEL; Unsigned long valmsk = GCCAP style. GCJInstyle; GC = XCreateGC (display, my_win, valmask, & valu); XDrawLine (display, my_win, gc, 5,5,20,20); XMapWindow (display, my_win); XFlush (display); Sleep (10); Return 0; }
thanks
The example in the tutorial is incorrect - if you & lt; X11 / Xlib.h & gt;
or read e, then you have a structure, XGCValues
is not an integral type, so start with something like this:
XGCValues value; Values.cap_style = CapButt; Values.join_style = JoinBevel;
Comments
Post a Comment