Solved

is not a pointer-to-object type

Posted on 2006-06-23
10
2,219 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now