Solved

is not a pointer-to-object type

Posted on 2006-06-23
10
2,227 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:rubentrancoso
  • 4
  • 4
10 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 16973098
And where exactly are you getting that error?
0
 

Author Comment

by:rubentrancoso
ID: 16973126
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
0
 
LVL 86

Expert Comment

by:jkr
ID: 16973143
What type is 'toolkit'? That seems to be the cuplrit here.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:rubentrancoso
ID: 16973174
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
0
 
LVL 86

Expert Comment

by:jkr
ID: 16973204
>>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);
0
 

Author Comment

by:rubentrancoso
ID: 16973264
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*
0
 
LVL 86

Expert Comment

by:jkr
ID: 16973825
Well, what about posting your toolkit class' declaration?
0
 

Author Comment

by:rubentrancoso
ID: 16973871
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.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17258158
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question