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)