Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
ANSI C++ forbids declaration `res' with no type
« on: April 25, 2009, 09:47:28 PM »
Once again, I'd ordinarily post this on UtilityBase but they haven't gotten rid of their "bad juju" at the moment... :(

Trying to compile a MUI example, I'm getting lots of errors. Instead of compiling this in AmiDevCpp like I normally do, I tried compiling it in G++ directly in UAE using this command: g++ -noixemul -I InclMUID: -I InclOS39: -o MUITest MUITest.cpp

This is the results:
Quote
InclMUID:inline/muimaster.h: In function `void MUI_FreeAslRequest(void *)':
InclMUID:inline/muimaster.h:133: ANSI C++ forbids declaration `res' with no type


Not sure how to fix this. Clues appreciated.

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #1 on: April 25, 2009, 10:08:57 PM »
Except I get the exact same results when I compile using gcc, Kronos. :)

The code looks like this:
Code: [Select]
#ifndef PROTO_MUIMASTER_H
#define PROTO_MUIMASTER_H

#ifndef LIBRARIES_MUI_H
#include <libraries/mui.h>
#endif /* !LIBRARIES_MUI_H */

#include <clib/muimaster_protos.h>

#ifdef __GNUC__
#include <inline/muimaster.h>
#endif /* __GNUC__ */

#ifndef __NOLIBBASE__
extern struct Library *
#ifdef __CONSTLIBBASEDECL__
__CONSTLIBBASEDECL__
#endif /* __CONSTLIBBASEDECL__ */
MUIMasterBase;
#endif /* !__NOLIBBASE__ */

#endif /* !PROTO_MUIMASTER_H */


Someone wrote on UtilityBase that they fixed it using fd2pragma, but didn't demonstrate how. I got no clues on how to use fd2pragma, unfortunately.

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #2 on: April 25, 2009, 10:17:22 PM »
These are the errors I get, BTW, when I compile it in AmiDevCpp:
Quote
11 W:\Projects\Amiga\MUI\MuiTest.cpp In file included from MuiTest.cpp
 P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include\inline\muimaster.h In function `Object * MUI_NewObjectA(char *, TagItem *)':
10 P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include\inline\muimaster.h parse error before `__asm'
10 P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include\inline\muimaster.h parse error before `*'
10 P:\Windows\AmiDevCpp\usr\local\amiga\m68k-amigaos\sys-include\inline\muimaster.h parse error before `*'


Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #3 on: April 25, 2009, 10:25:43 PM »
I get an undefined reference to main when I comment it out in both compilers.

The code in question looks like this:
Code: [Select]
static __inline Object * MUI_NewObjectA(char * a0arg, struct TagItem * tags)
{
  return ((Object * (*)(char * __asm(&quot;a0&quot;), struct TagItem * __asm(&quot;a1&quot;), struct Library * __asm(&quot;a6&quot;)))
  (((char *) MUIMASTER_BASE_NAME) - 30))(a0arg, tags, MUIMASTER_BASE_NAME);

}

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #4 on: April 25, 2009, 10:46:56 PM »
Sure, if you got examples that do compile, I'd welcome the chance to try them. I could at least know then the problem was definitely me, although I'm fairly convinced of that anyway. ;)

Now, taking your point seriously about the missing main, I switched my source code examples and compiled a different example after commenting out the inline/muimaster.h. I'm still getting the error in question when compiling against gcc, but they disappear when compiling against AmiDevCpp. I still have errors in both, but at least there's some clues here. Perhaps a difference in include files?

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #5 on: April 26, 2009, 12:29:29 AM »
Pursuing things further in AmiDevCpp, following Kronos' advice and commenting out that inline/muimaster.h reduces my errors to just these:
Quote
94 W:\Projects\Amiga\MUI\MuiTest.cpp implicit declaration of function `int DoMethod(...)'
96 W:\Projects\Amiga\MUI\MuiTest.cpp implicit declaration of function `int set(...)'
113 W:\Projects\Amiga\MUI\MuiTest.cpp ANSI C++ forbids implicit conversion from `void *' in argument passing


I tried linking it to Amiga.lib, but that didn't work. I'm not sure if I need to declare those methods as externs or just pic the right library. Once again, if anyone's got some clues, I'd love to hear them.

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #6 on: April 28, 2009, 04:36:05 PM »
[bump]

OK, so no one can tell me how to get rid of this implicit declaration error? I assume it's some compiler or linker setting...

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #7 on: April 29, 2009, 02:53:20 AM »
Ummm... the problem is, Kronos, I *AM* using the MUI SDK examples. I am assuming that this is a difference in compilers and/or environments as I am now attempting this is AmiDevCpp. I've made better progress there than using GCC on UAE.

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.

If you've got something out there that explains all the proper steps in the proper order, by all means, clue me in...

Now, having said all that, the only library I can find that has a reference to the DoMethod procedure is the clib/alib_protos.h which looks right but for all I know isn't.

It certainly changes my errors to this:
Quote
99 W:\Projects\Amiga\MUI\MuiTest.cpp ANSI C++ forbids implicit conversion from `void *' in argument passing


With the code in question looking like this:
Code: [Select]
while (DoMethod(app,MUIM_Application_NewInput,&sigs) != MUIV_Application_ReturnID_Quit)

Ed.
Ed.
 

Offline EDanaIITopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 579
    • Show all replies
    • http://www.EdwardGDanaII.info
Re: ANSI C++ forbids declaration `res' with no type
« Reply #8 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.