Welcome, Guest. Please login or register.

Author Topic: ANSI C++ forbids declaration `res' with no type  (Read 3745 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Fab12

  • Newbie
  • *
  • Join Date: Sep 2006
  • Posts: 37
    • Show only replies by Fab12
Re: ANSI C++ forbids declaration `res' with no type
« Reply #14 from previous page: April 29, 2009, 03:08:07 AM »
Easy one. C++ is much more strict about types and doesn't allow implicit casting to (void *).
As DoMethod() expect "Object *" as object, either define your MUI objects as Object * instead of APTR, or cast them to (Object*) in DoMethod() call.

Having compiled mui classes for OWB-MorphOS in C++, I can safely say casts are the main difference to C. Can't remember any other issue so far.
 

Offline Heinz

  • Full Member
  • ***
  • Join Date: Nov 2005
  • Posts: 154
    • Show only replies by Heinz
    • http://amidevcpp.amiga-world.de
Re: ANSI C++ forbids declaration `res' with no type
« Reply #15 on: April 29, 2009, 07:46:21 AM »
Quote

EDanaII wrote:


And, c'mon guys, gimmee a break. :-) It's not like I can go out and buy a book on this stuff. Believe me, I'd love to, but all the different (and meager) sources I can find don't clue me in on a whole lot, otherwise I wouldn't be buggin' you here.


ZUNE Application Development Manual

It is not really a book, but could be a starting point.
This will compile for AROS but only for C.

For C++ you will need some changes.

set(...) and get(...) will conflict with c+ set and get methods.
For AROS you can do that at the beginning of your main.c:

#undef set(copy and paste from your libraries/mui.h) #define ZUNESET(copy and paste from your libraries/mui.h)

and do the same for get(...).

You may also look at this zune c++ example:


http://amidevcpp.amiga-world.de/Examples/info/TextEditorExample.zip.php

or this more recent one:

http://archives.aros-exec.org/index.php?function=showfile&file=utility/text/edit/simpleeditor-i386.zip
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show only replies by EDanaII
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #16 on: May 03, 2009, 02:53:57 PM »
Thanks for the feedback, guys. Unfortunately, I've given up out of frustration (and priorities) at the moment. So, I'll try your advice later, as time allows.

Ed.
Ed.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: ANSI C++ forbids declaration `res' with no type
« Reply #17 on: May 03, 2009, 03:40:02 PM »
I blame the rampant proliferation of macros that is the norm with all gadtools derived UI systems.

In theory, this is a simple error but finding errors that are the result of improperly expanded preprocessor macros is not straightforward.
int p; // A
 

Offline Fab12

  • Newbie
  • *
  • Join Date: Sep 2006
  • Posts: 37
    • Show only replies by Fab12
Re: ANSI C++ forbids declaration `res' with no type
« Reply #18 on: May 03, 2009, 04:39:54 PM »
It's actually quite straightforward, and gcc -E is a good friend for that. :)