• Linux and C with OpenDoors

    From Black Panther@21:1/186 to All on Wed Jul 3 15:31:44 2019
    Hi All,

    I know there's a few programmers out here that have written C programs using OpenDoors.

    I'm trying to learn how this works, and have started using Visual Studio
    Code. I've got a small "door game" written, but I'm getting errors when
    trying to compile it.

    Here is my awesome door game... ;)

    int main()
    {
    od_printf("Welcome to my first door program!\n\r");
    od_printf("Press a key to return to BBS!\n\r");
    od_get_key(TRUE);
    od_exit(0, FALSE);
    return 0;
    }

    I do have the #include "OpenDoor.h", and it should be finding it, as it isn't giving me that error anymore... Here is what I am getting:

    /usr/bin/ld: /tmp/ccAVxTuQ.o: in function 'main':
    main.c:(.text+0x11): undefined reference to 'od_printf'
    /usr/bin/ld: main.c:(.text+0x22): undefined reference to 'od_printf'
    /usr/bin/ld: main.c:(.text+0x2c): undefined reference to 'od_get_key'
    /usr/bin/ld: main.c:(.text+0x3b): undefined reference to 'od_exit'
    collect2: error: ld returned 1 exit status

    I'm guessing it's because I don't have ODoors located in the /usr/lib, but
    I'm not sure. Also, in the ODoors docs, it mentions having to set up the
    linker to the libraries. Which libraries do I use for Linux, and how are
    those set up in VSCode?

    Sorry for sounding like a newbie, but I am with C...

    Thanks


    ---

    |03B|09lack |03P|09anther|03(|09RCS|03)|07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Digital Man@21:1/183 to Black Panther on Wed Jul 3 14:58:25 2019
    Re: Linux and C with OpenDoors
    By: Black Panther to All on Wed Jul 03 2019 03:31 pm

    Hi All,

    I know there's a few programmers out here that have written C programs using OpenDoors.

    I'm trying to learn how this works, and have started using Visual Studio Code. I've got a small "door game" written, but I'm getting errors when trying to compile it.

    Here is my awesome door game... ;)

    int main()
    {
    od_printf("Welcome to my first door program!\n\r");
    od_printf("Press a key to return to BBS!\n\r");
    od_get_key(TRUE);
    od_exit(0, FALSE);
    return 0;
    }

    I do have the #include "OpenDoor.h", and it should be finding it, as it isn't giving me that error anymore... Here is what I am getting:

    /usr/bin/ld: /tmp/ccAVxTuQ.o: in function 'main':
    main.c:(.text+0x11): undefined reference to 'od_printf'
    /usr/bin/ld: main.c:(.text+0x22): undefined reference to 'od_printf'
    /usr/bin/ld: main.c:(.text+0x2c): undefined reference to 'od_get_key'
    /usr/bin/ld: main.c:(.text+0x3b): undefined reference to 'od_exit' collect2: error: ld returned 1 exit status

    I'm guessing it's because I don't have ODoors located in the /usr/lib, but I'm not sure.

    It doesn't haven't to be in /usr/lib or any other specific directory. If ODoors
    is built/used as a shared object (.so file), then it's certainly easier if it's in a directory that's expressed in your LD_LIBRARY_PATH environment variable, but not strictly necessary.

    If you're building/using ODoors as a static-link library (.a file), then you don't need it anywhere specific, but the linker (gcc, g++ or ld) does need to be able to find it. And you to have to use the -l option to tell the linker to link with it in the first place (e.g. -lodoors).

    digital man

    Synchronet "Real Fact" #26:
    The Synchronet Web Server was written predominantly by Stephen Hurd (Deuce). Norco, CA WX: 80.6°F, 51.0% humidity, 7 mph ENE wind, 0.00 inches rain/24hrs --- SBBSecho 3.07-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (21:1/183)
  • From Black Panther@21:1/186 to Digital Man on Sat Jul 6 23:16:58 2019
    On 03 Jul 2019, Digital Man said the following...

    If you're building/using ODoors as a static-link library (.a file), then you don't need it anywhere specific, but the linker (gcc, g++ or ld)
    does need to be able to find it. And you to have to use the -l option to tell the linker to link with it in the first place (e.g. -lodoors).

    Got it now. I had an old version, so I grabbed the copy that you have in your CVS, and didn't have any issues...

    Thank you.


    ---

    |03B|09lack |03P|09anther|03(|09RCS|03)|07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)