Welcome, Guest. Please login or register.

Author Topic: Compiler  (Read 13937 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #14 on: May 31, 2003, 10:45:09 PM »
I've had gcc compile a simple program now, but it doesn't want to link
any libs. For instance, if I type:

c++ -l gcc:os-lib/reaction.lib test1.c -o test

A requester pops up saying:

Please insert volume
/gnu/lib/gcc-lib/mc68020-cbm-a
in any drive

After clicking cancel a few times it then asks for
"/local/lib/gcc-lib/mc68020-cbm" and then "/gnu/lib/libgcc" and then
"/local/lib/libgcc" and finally, in the shell window I get: ld: No
such file or directory for libgcc:lib/reaction.lib.a

Am I doing this right?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #15 on: May 31, 2003, 10:50:52 PM »
And if I use the -lobjc argument I get ld: maformed input file (not
rel or archive) gcc:lib/reaction.lib
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #16 on: May 31, 2003, 11:32:36 PM »
After doing a little experimenting, the bottom line seems to be that gcc expects an .a extention to all linker libs, whereas the one i'm trying to link has a .lib extension. Renaming it doesn`t help, it thinks the file is corrupt. Can someone explain to me how to link the .lib files or why they won`t work?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #17 on: June 01, 2003, 01:15:01 AM »
Maybe i'm asking the wrong questions. I want to produce a reaction GUI, and so far GCC seems to be the most promising choice for a compiler. If anyone has coded in reaction in gcc, maybe they can help me. :)
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #18 on: June 01, 2003, 03:09:03 AM »
Thanks for that. The c++ command was necessary because gcc doesn't like the "//" comment, and it appears in a lot of the header files.

Let me get something straight about libraries... linker libraries include code into the main program during the linking process? And .library files load functions into the program on execution? If my understanding of the latter is correct, how can I prevent the program from complaining about the absence of a function that comes from a .library file?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #19 on: June 01, 2003, 03:15:03 AM »
Another thing... i've looked on aminet and on google and can't find anything to convert amiga link libraries into gnu c link libraries. Does this mean I can't use third party link libraries in gcc, or am I not looking hard enough?

Edit: oops, turns out the util to do it was in my gcc package. :P
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #20 on: June 01, 2003, 04:23:07 AM »
Seems some libs won't convert anyway... such as the mui linker libraries and reaction.lib.

When converting reaction.lib I get:

Convert this library into ALINK (join type) format.

How do I do this?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #21 on: June 01, 2003, 04:11:13 PM »
It seems that if I setup a pointer to the opened library, (like intuitionbase, as you said) the compiler won't complain. Thanks. :)
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #22 on: June 01, 2003, 04:38:36 PM »
I hope noone minds me asking another coding question... ;) I would like to know how you go about creating another thread/process?

For instance, if I had the function  STRPTR FRequester(STRPTR pattern, STRPTR pathname) which displayed a file requester window, this function would normally stall the rest of the program until the file requester closed and the function returned. How could I have this function call move onto another thread/process (not sure what the correct terminology is here) so that my program could multitask and do other things?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #23 on: June 01, 2003, 05:16:59 PM »
Thanks.
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #24 on: June 02, 2003, 02:41:44 PM »
OK I am finally getting somewhere now. I decided to begin with learning MUI instead of Reaction, as I can't find any documentation on Reaction.

I have successfully made a program which opens some libraries including muimaster, generates some objects, enters a loop and closes them. However there is one 'warning' that is giving me trouble when compiling:
warning: implicit declaration of function 'int DoMethod(...)'

This function is essential for MUI. According to the docs I have, it is defined in amiga.lib. However the location of the prototype isn't mentioned. I would assume that it were in or but including these does not solve the problem. Here is my code in full so someone can point out if I'm doing anything else wrong. :) (and yes I realise I don't do any error checking ;) )

-- main.h

void InitLibs(void);
void FreeLibs(void);
void InitMasterLoop(void);
void InitInterface(void);

extern Object * Application;
extern Object * AppWindow;

-- main.c

#include
#include
#include
#include
#include
#include
#include

#include "main.h"

struct IntuitionBase * IntuitionBase;
struct Library * MUIMasterBase;

Object * Application;
Object * AppWindow;

int main(int argc, char ** argv)
{
    InitLibs(); // Load runtime libraries
    InitInterface(); // Define MUI Objects

    SetAttrs(AppWindow, MUIA_Window_Open, TRUE);

    InitMasterLoop(); // Begin main loop

    SetAttrs(AppWindow, MUIA_Window_Open, FALSE);

    MUI_DisposeObject(Application);
   
    FreeLibs();

    return 0;
}

void InitLibs(void)
{
    MUIMasterBase = OpenLibrary("muimaster.library", 19);
}

void FreeLibs(void);
{
    CloseLibrary(MUIMasterBase);
}

void InitMasterLoop(void)
{
    ULONG sigs = 0;

    while(DoMethod(Application, MUIM_Application_NewInput, &sigs) != MUIV_Application_ReturnID_Quit)
     {
        if(sigs)
        {
            sigs = Wait(sigs | SIGBREAKF_CTRL_C);
            if(sigs & SIGBREAKF_CTRL_C) break;
        }
    }
}

void InitInterface(void)
{
    Application = MUI_NewObject(MUIC_Application,
        MUIA_Application_Title, "MUITest",
        MUIA_Application_Version, "0",
        MUIA_Application_Copyright, "",
        MUIA_Application_Author, ""
        MUIA_Application_Description, "",
        MUIA_Application_Base, ""
        MUIA_Application_Window,
            (AppWindow = MUI_NewObject(MUIC_Window,
                MUIA_Window_Activate, TRUE,
                MUIA_Window_AppWindow, TRUE,
        TAG_DONE)),
    TAG_DONE);
}

// And that's it!
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #25 on: June 02, 2003, 02:45:51 PM »
Sorry, seems the board removed the indenting. :-P
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #26 on: June 02, 2003, 09:35:56 PM »
@Karlos: Why is void deprecated, and what should I use instead?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #27 on: June 02, 2003, 09:39:10 PM »
@Piru: Thanks I'll take a look.
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #28 on: June 02, 2003, 09:51:20 PM »
OK. Well here's an update on my program. I included the header clib/alib_protos.h> and the program compiled and linked without a single warning or error. However, when I run it, WinUAE exits completely! It never fails to do this. No crash, or anything. It just exits instantly. What the heck could be wrong here?
 

Offline quiesceTopic starter

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 72
    • Show all replies
Re: Compiler
« Reply #29 from previous page: June 02, 2003, 09:55:55 PM »
That's all well and good if it works for you but I can't code if it won't run in WinUAE (I haven't had a real amiga in over a year).