Date: Mon, 24 Aug 92 13:42:11 +0100 From: buers AT dg1 DOT chemie DOT uni-konstanz DOT de (Dieter Buerssner) To: djgpp AT sun DOT soe DOT clarkson DOT edu Cc: csaba AT vuse DOT vanderbilt DOT edu, dj AT ctron DOT com Subject: weird ld error (multiply defined symbol) The following program gives a linker error with djgpp ver. 1.08 and cbgrx version 1.02 (and with earlier versions too): #include #include #include main() { GrSetMode(GR_default_text); gotoxy(1,1); /* if you comment this line out, and don't link with -lpc, the linker error goes away */ getkey(); } % gcc -o test test.c -lgrx -lpc getkey.o: Definition of symbol _getkey (multiply defined) getkey.o: Definition of symbol _getkey (multiply defined) Can anybody reproduce this? I might have failed to notice something really basic. Can anybody explain this behaviour. I thought the linker just takes the function it finds first. A workaround is to delete getkey.o from libgrx.a with % ar d /djgpp/lib/libgrx.a getkey.o or similar. The sources of getkey() in libc and libgrx are different. Does libgrx really need a private version of getkey() or does it work with the version in libc too? (It seems to work for me) Thanks, Dieter Dieter Buerssner (B\"ur\ss{}ner) -- buers AT dg1 DOT chemie DOT uni-konstanz DOT de Universitaet Konstanz -- Fakultaet Chemie -- Postfach 5560 7750 Konstanz -- Germany -- phone +49-7531-882021