Link to home
Start Free TrialLog in
Avatar of rubentrancoso
rubentrancoso

asked on

is not a pointer-to-object type

I'm trying to compila some code with XLib call and getting the following error: void* is not a pointer-to-object type.
the lines with this erro is:

   Window win;
   unsigned long valuemask = 0;
   XGCValues values;
   unsigned int line_width = 6;
   int line_style = LineOnOffDash;
   int cap_style = CapRound;
   int join_style = JoinRound;
   int dash_offset = 0;
   static char dash_list[] = {12, 24};
   int list_length = 2;
etc..

//    Display* ToolKit::getDisplay();


      *gc = XCreateGC(toolkit->getDisplay(), win, valuemask, &values);
      XSetFont(toolkit->getDisplay(), *gc, font_info->fid);
      XSetForeground(toolkit->getDisplay(), *gc, BlackPixel(toolkit->getDisplay(),toolkit->getScreenNum()));
      XSetLineAttributes(toolkit->getDisplay(), *gc, line_width, line_style, cap_style, join_style);
      XSetDashes(toolkit->getDisplay(), *gc, dash_offset, dash_list, list_length);


Someone can help? I relay not understanting what's happen once all types appear to be corrects.
Avatar of jkr
jkr
Flag of Germany image

And where exactly are you getting that error?
Avatar of rubentrancoso
rubentrancoso

ASKER

all this lines:

*gc = XCreateGC(toolkit->getDisplay(), win, valuemask, &values);
     XSetFont(toolkit->getDisplay(), *gc, font_info->fid);
     XSetForeground(toolkit->getDisplay(), *gc, BlackPixel(toolkit->getDisplay(),toolkit->getScreenNum()));
     XSetLineAttributes(toolkit->getDisplay(), *gc, line_width, line_style, cap_style, join_style);
     XSetDashes(toolkit->getDisplay(), *gc, dash_offset, dash_list, list_length);

../widgets/Frame.cpp:83: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:85: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:88: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:88: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:88: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:90: error: `void*' is not a pointer-to-object type
../widgets/Frame.cpp:92: error: `void*' is not a pointer-to-object type
What type is 'toolkit'? That seems to be the cuplrit here.
yes, is what i had discovered when I replace toolkit->getDisplay() by NULL

static void* toolkit = NULL;

my doubt is that the return type for getDisplay is the type XLib function is expecting
>>my doubt is that the return type for getDisplay is the type XLib function is expecting

Well, it should be, depending on your "toolkit". But, you could always

Display* pDisp = XOpenDisplay ();

GC gc = XCreateGC(pDisp, win, valuemask, &values);
     XSetFont(pDisp, gc, font_info->fid);
     XSetForeground(pDisp, gc, BlackPixel(pDisp,CorrectScreenNumHere));
     XSetLineAttributes(pDisp, gc, line_width, line_style, cap_style, join_style);
     XSetDashes(pDisp, gc, dash_offset, dash_list, list_length);
There's other calls on the same class that do it with no problem. But in this part of code neither I cast toolkit to the ToolKit class I avoid the error

getDisplay returns justa a Display*
Well, what about posting your toolkit class' declaration?
I was haging problems definig ToolKit* toolkit in the ToolKit class, then I placed it as a global in the END OF ToolKit header and it works.
ASKER CERTIFIED SOLUTION
Avatar of CetusMOD
CetusMOD
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial