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->getDisp lay(), win, valuemask, &values);
XSetFont(toolkit->getDispl ay(), *gc, font_info->fid);
XSetForeground(toolkit->ge tDisplay() , *gc, BlackPixel(toolkit->getDis play(),too lkit->getS creenNum() ));
XSetLineAttributes(toolkit ->getDispl ay(), *gc, line_width, line_style, cap_style, join_style);
XSetDashes(toolkit->getDis play(), *gc, dash_offset, dash_list, list_length);
Someone can help? I relay not understanting what's happen once all types appear to be corrects.
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->getDisp
XSetFont(toolkit->getDispl
XSetForeground(toolkit->ge
XSetLineAttributes(toolkit
XSetDashes(toolkit->getDis
Someone can help? I relay not understanting what's happen once all types appear to be corrects.
And where exactly are you getting that error?
ASKER
all this lines:
*gc = XCreateGC(toolkit->getDisp lay(), win, valuemask, &values);
XSetFont(toolkit->getDispl ay(), *gc, font_info->fid);
XSetForeground(toolkit->ge tDisplay() , *gc, BlackPixel(toolkit->getDis play(),too lkit->getS creenNum() ));
XSetLineAttributes(toolkit ->getDispl ay(), *gc, line_width, line_style, cap_style, join_style);
XSetDashes(toolkit->getDis play(), *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
*gc = XCreateGC(toolkit->getDisp
XSetFont(toolkit->getDispl
XSetForeground(toolkit->ge
XSetLineAttributes(toolkit
XSetDashes(toolkit->getDis
../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.
ASKER
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
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,CorrectSc reenNumHer e));
XSetLineAttributes(pDisp, gc, line_width, line_style, cap_style, join_style);
XSetDashes(pDisp, gc, dash_offset, dash_list, list_length);
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,CorrectSc
XSetLineAttributes(pDisp, gc, line_width, line_style, cap_style, join_style);
XSetDashes(pDisp, gc, dash_offset, dash_list, list_length);
ASKER
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*
getDisplay returns justa a Display*
Well, what about posting your toolkit class' declaration?
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.