Hi, im having problems with a project I am working on. It is a class that creates an xlib window. Here is the code:
main.cpp
ys_window.hCode:#include <X11/Xlib.h> #include "ys_window.h" int main(){ //window object ys_window wind; wind.showwindow(true); while(1){ XEvent e; } return 0; }
ys_window.cppCode:#ifndef YS_WINDOW_H_INCLUDED #define YS_WINDOW_H_INCLUDED class ys_window; #endif // YS_WINDOW_H_INCLUDED
I keep getting the error "/root/Development/ys_framework/main.cpp|7|error: aggregate ‘ys_window wind’ has incomplete type and cannot be defined|"Code:#include <X11/Xlib.h> #include <cairo.h> #include <cairo-xlib.h> class ys_window{ private: int xsize; int ysize; int xpos; int ypos; bool visible; //cairo variables cairo_surface_t *cs; cairo_t *c; //xlib variables Display *dpy; int blackcolour; Window w; public: ys_window(){ //set the default values to create the window xsize = 200; ysize = 200; xpos = 200; ypos = 200; //the xlib display variable dpy = XOpenDisplay(0); //colour used to blackout the window blackcolour = BlackPixel(dpy, DefaultScreen(dpy)); //create the window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), xpos, ypos, xsize, ysize, 0, blackcolour, blackcolour); XFlush(dpy); }; void showwindow(bool visible); }; void ys_window::showwindow(bool vis) { if(vis == true){ XMapWindow(dpy, w); }else{ XUnmapWindow(dpy, w); } XFlush(dpy); visible = vis; }




Reply With Quote