bebbo / amiga-gcc

The GNU C-Compiler with Binutils and other useful tools for cross development for Amiga
GNU General Public License v2.0
312 stars 66 forks source link

Unable to compile a Reaction snippet from the NDK3.2 #384

Closed rosneru closed 6 months ago

rosneru commented 6 months ago

The attached file Layout1.c is one of the examples from the NDK3.2 and like most of these examples it shows how to create programs with Reaction.

It makes heavy use of the macros defined in reaction_macros.h which I also attached here. But Layout1.c fails to compile stating:

$ m68k-amigaos-gcc Layout1.c

    Layout1.c: In function 'main':
    Layout1.c:307:0: error: unterminated argument list invoking macro "NewObject"
     }

    Layout1.c:66:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
      gParent = VGroupObject,
              ^
    Layout1.c:66:2: error: expected ';' at end of input
      gParent = VGroupObject,
      ^~~~~~~
    Layout1.c:66:2: error: expected declaration or statement at end of input

$

With SAS-C it works with this commandline:

sc LINK Layout1.c LIB lib:reaction.lib NOSTACKCHECK 

What do I have to do to make it work with gcc 6.5?

Layout1.c.md reaction_macros.h.md

bebbo commented 6 months ago
  1. Update your amiga-gcc, and at least rebuild libnix:

    make update
    make clean-libnix
    make libnix
  2. You have to define NO_INLINE_STDARG.

    m68k-amigaos-gcc Layout1.c -o Layout1 -noixemul -Os  -DNO_INLINE_STDARG

    grafik

rosneru commented 6 months ago

Thank you, this works!

I have one last question regarding Reaction: When compiling another example from the 3.2 NDK, Cooser1.c (attached) it still fails. Because there is a function call of FreeChooserLabels() which is declared in clib/reaction_lib_protos.h and uses code from linker library reaction.lib.

The thing is

Is there a way to use this lib from gcc?

Chooser1.c.md

bebbo commented 6 months ago

try copying that lib into opt/amiga/lib and add -lreaction ...

rosneru commented 6 months ago

Unfortunately it didn't work:

m68k-amigaos/bin/ld: cannot find -lreaction: No such file or directory

I copied it to /opt/amiga/lib and also to /opt/amiga/m68k-amigaos/lib. I also noticed that apart from the copied reaction.lib all other files in those directories have a .a extension.

bebbo commented 6 months ago

rename it to libreaction.a

rosneru commented 6 months ago

This works:-) Thank you!