Welcome, Guest. Please login or register.

Author Topic: Error on DoMethod()  (Read 2501 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JettahTopic starter

  • Full Member
  • ***
  • Join Date: Nov 2003
  • Posts: 115
    • Show all replies
Error on DoMethod()
« on: December 08, 2004, 04:41:57 PM »
Hi,

While designing a simple program I encountered an error and a warning when using DoMethod().

Here is a part of the offending source:

struct Window *Win = NULL;
if (Win = (struct Window *)DoMethod(&WinObj, WM_OPEN, NULL))
{
//anything usefull here
}

The warning is: cast does not match function type
The error sounds: Win has an incomplete type

Can anyone shed some light on this matter?

Regards,

Jettah
Sometimes I wish I was Mt Vesuvius: laying on my back in the sun while smoking a bit and everybody seeing me would say: \\"Look! He\\\'s active!\\" (author unknown to me)
 

Offline JettahTopic starter

  • Full Member
  • ***
  • Join Date: Nov 2003
  • Posts: 115
    • Show all replies
Re: Error on DoMethod()
« Reply #1 on: December 08, 2004, 05:02:36 PM »
@Piru

Stands corrected. My keyboard is a bit sticky on that particular key.

The source code however does contain that parenthesis.

Thanks anyway

Jettah
Sometimes I wish I was Mt Vesuvius: laying on my back in the sun while smoking a bit and everybody seeing me would say: \\"Look! He\\\'s active!\\" (author unknown to me)
 

Offline JettahTopic starter

  • Full Member
  • ***
  • Join Date: Nov 2003
  • Posts: 115
    • Show all replies
Re: Error on DoMethod()
« Reply #2 on: December 08, 2004, 05:41:15 PM »
@DaveP

"Check you have all the intuition includes required in order to use it."

struct Window is defined in intuition/intuition.h, which is included.

Thanks

Jettah

Sometimes I wish I was Mt Vesuvius: laying on my back in the sun while smoking a bit and everybody seeing me would say: \\"Look! He\\\'s active!\\" (author unknown to me)
 

Offline JettahTopic starter

  • Full Member
  • ***
  • Join Date: Nov 2003
  • Posts: 115
    • Show all replies
Re: Error on DoMethod()
« Reply #3 on: December 09, 2004, 08:31:19 AM »
@Thomas


Up to now I have this piece of source code (relevant part only):

{                                                 // level 0
Object *WinObj = NULL;
if (WinObj = )
{                                                 // level 1
struct Window *Win = NULL;
if (Win = struct Window *)DoMethod(WinObj, WM_OPEN, NULL))
{                                                 // level 2
// Try to do the usefull stuff here...

DoMethod(WInObj, WM_CLOSE, NULL);
Win    = NULL;
WinSig = 0L;
}                                                 // level 2
DisposeObject((Object *)WinObj);
WinObj = NULL;
}                                                 // level 1
}                                                 // level 0

I now get the WARNING: cast does not match funktion type
intuition protos are included explicitly:
#include

Sytem used: A1200 OS3.9 StormC4 Gcc

Why, oh why, do I get a warning about a cast? IMHO I'm doing it the correct way, but I can be wrong of course.

Thanks,

Jettah
Sometimes I wish I was Mt Vesuvius: laying on my back in the sun while smoking a bit and everybody seeing me would say: \\"Look! He\\\'s active!\\" (author unknown to me)
 

Offline JettahTopic starter

  • Full Member
  • ***
  • Join Date: Nov 2003
  • Posts: 115
    • Show all replies
Re: Error on DoMethod()
« Reply #4 on: December 09, 2004, 09:54:47 AM »
@Thomas

Quote
On OS3.9 you have to include clib/alib_protos.h for the DoMethod prototype.


This file has been included (was included all the way).

Changed the offending line.
FROM:
if (Win = (struct Window *)DoMethod(WinObj, WM_OPEN, NULL))

TO:
if ((ULONG)Win = DoMethod(WinObj, WM_OPEN, NULL))

The WARNING has now gone, but I do have a feeling that it is not a correct way of doing things. Am I wrong in this respect?

EDIT:
The program compiles and links well. It executes fine, so I assume it is correct now!

Thanks, for all your remarks, wisdom and knowledge. I'm very satisfied.
To me, this topic is closed.

Jettah
Sometimes I wish I was Mt Vesuvius: laying on my back in the sun while smoking a bit and everybody seeing me would say: \\"Look! He\\\'s active!\\" (author unknown to me)