Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: jahc on June 27, 2003, 06:12:50 AM

Title: Need help compiling Reaction examples with GCC
Post by: jahc on June 27, 2003, 06:12:50 AM
I'm trying to compile the Reaction examples that were included in the 3.9 NDK. I'm using GCC 2.95.3.. these are the errors I get on the listbrowser example:

5.dh2:NDK_3.9/Examples/Reaction/ListBrowser> g++ test.cpp
test.cpp:112: warning: initialization of negative value `-1' to `ULONG'
test.cpp:118: warning: initialization of negative value `-1' to `ULONG'
test.cpp: In function `int main()':
test.cpp:189: warning: negative value `-1' passed as argument 3 of `AddGList(Window *, Gadget *, long unsigned int, long int, Requester *)'
/t/cc0z7FsB.o(.text+0x57e): undefined reference to `LISTBROWSER_GetClass'
/t/cc0z7FsB.o(.text+0x8ba): undefined reference to `LABEL_GetClass'
/t/cc0z7FsB.o(.text+0x914): undefined reference to `LABEL_GetClass'
/t/cc0z7FsB.o(.text+0x954): undefined reference to `AllocListBrowserNode'
/t/cc0z7FsB.o(.text+0x99e): undefined reference to `AllocListBrowserNode'
/t/cc0z7FsB.o(.text+0xa48): undefined reference to `FreeListBrowserNode'
/t/cc0z7FsB.o(.text+0xa54): undefined reference to `FreeListBrowserNode'
/t/cc0z7FsB.o(.text+0xd74): undefined reference to `AllocListBrowserNode'
/t/cc0z7FsB.o(.text+0xdd6): undefined reference to `FreeListBrowserNode'
/gg/lib/libamiga.a(lockpubscreen.o)(.text+0x4): undefined reference to `IntuitionBase'
/gg/lib/libamiga.a(openwindowtags.)(.text+0x4): undefined reference to `IntuitionBase'
/gg/lib/libamiga.a(newobject.o)(.text+0x6): undefined reference to `IntuitionBase'
/gg/lib/libamiga.a(addglist.o)(.text+0x6): undefined reference to `IntuitionBase'
/gg/lib/libamiga.a(refreshglist.o)(.text+0x6): undefined reference to `IntuitionBase'
/gg/lib/libamiga.a(setwindowtitles.o)(.text+0x6): more undefined references to `IntuitionBase' follow
collect2: ld returned 1 exit status


.. What do I need to do to get this to work? I'm a bit of a programming newbie, so please excuse my ignorance.
Title: Re: Need help compiling Reaction examples with GCC
Post by: Mr_Capehill on June 27, 2003, 06:57:32 AM
Did you use fd2pragma to create correct headers, and include protos?

Warnings: you can't put -1 to an unasigned variable.

BTW: if you are compiling only C program, 'gc' should be enough.
Title: Re: Need help compiling Reaction examples with GCC
Post by: jahc on June 27, 2003, 07:34:48 AM
Quote
Did you use fd2pragma to create correct headers, and include protos?

Yes.

-Edit- the example compiles perfectly in stormc 3.0 , however I want to use GCC so that my stuff will recompile easily for OS 4.0.
Title: Re: Need help compiling Reaction examples with GCC
Post by: Highflyer on June 27, 2003, 08:32:01 AM
Quote

-Edit- the example compiles perfectly in stormc 3.0 , however I want to use GCC so that my stuff will recompile easily for OS 4.0.


Stormc opens the various libraries automatically. For gcc, did you add -lauto when compiling?
Title: Re: Need help compiling Reaction examples with GCC
Post by: jahc on June 27, 2003, 08:46:16 AM
/gg/m68k-amigaos/bin/ld: cannot open -lauto: No such file or directory

doesnt seem to work.. g++ -lauto test.cpp or g++ test.cpp -lauto  .. or gcc with those combinations.

Title: Re: Need help compiling Reaction examples with GCC
Post by: jahc on June 27, 2003, 08:48:02 AM
If there are no solutions to this problem by the time I wake up tommorow morning, I will just use stormc. I'll just have to worry about porting to OS 4.0 when their dev kit comes out. It should be fully setup with reaction etc. I'm not being negative, I just want to start experimenting and achieving. :)

Thanks for your help so far guys.

-Edit- I couldnt wait till morning, I'm using stormc!! thanks anyway people.
Title: Re: Need help compiling Reaction examples with GCC
Post by: Highflyer on June 27, 2003, 02:13:42 PM
Quote

-Edit- I couldnt wait till morning, I'm using stormc!! thanks anyway people.


Just in case you or someone else is interested: where is the libauto.a? The trick with gcc is that the names of the libraries don't match the way you call them (libamiga.a is -lamiga etc)
I had the same errors when switching from stormc to gcc, and -lauto solved the undefined references. For the type conversion, I remember that's because stormc is doing some of the work and with gcc you've got to be more explicit (check the autodocs or other sources compilable with gcc).
In the end I succeeded compiling reaction with gcc.
Title: Re: Need help compiling Reaction examples with GCC
Post by: kiasanth on September 10, 2003, 12:34:40 PM
Assuming you've used fd2Pragma to make new includes you have to also use a different link library for reactionlib.a as the one that is supplied with the NDK only works on Storm C. you can get a replacement for reaction.lib at http://translate.google.com/translate?sourceid=navclient-menuext&hl=en&u=http%3A%2F%2Fwww%2Eguru%2Dmeditation%2Enet%2Fmain%2Ephp3%3Fnewsid%3D115 I've included the google translator in the URL so you know what it's talking about. I'm not sure but you may have to convert that lib as well using hunk2aout which is on aminet if you don't have it with your GCC distro.

-edit-

http://www.guru-meditation.net/main.php3?newsid=115       that's the address without translation
Title: Re: Need help compiling Reaction examples with GCC
Post by: kiasanth on September 10, 2003, 12:41:23 PM
Wow, I only just realised it was you Fibbles. and it's too late as I know you already converted to stormC ages ago. meanwhile, if it still matters you also have to declare IntuitionBase and open and close it (Well, That's what I did and it compiled)