sginn@hlthnt.UUCP (Steve Ginn) (05/02/91)
I was recently trying to compile the above named app and everything ran fine until it started linking and came up with the following problems: Version.c cc patch.o pch.o inp.o util.o version.o -o patch /bin/ld : error: Unresolved externals: _rindex in file(s): patch.o (patch.c) *** Error code 2 Stop. If anyone has any ideas, I would appreciate the help! Thanks in advance! Steve Ginn
srodawa@vela.acs.oakland.edu (Ron Srodawa) (05/03/91)
In article <44@hlthnt.UUCP> sginn@hlthnt.UUCP (Steve Ginn) writes: > >I was recently trying to compile the above named app and everything >ran fine until it started linking and came up with the following >problems: >/bin/ld : error: Unresolved externals: >_rindex in file(s): You have bumped into one of several common Berkeley BSD library routines that are not supported in the SCO Development System. (They are included as a part of the SCO TCP/IP Development System.) What follows is a shar file containing my own source code which I wrote when I had the same problem and before I had the SCO TCP/IP Development System. Anyone may use these routines freely for any purpose. No warranty. Hope these help you out of your bind.. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: bcmp.c bcopy.c bzero.c rindex.c # Wrapped by marian@smaczne on Fri May 3 00:40:50 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'bcmp.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bcmp.c'\" else echo shar: Extracting \"'bcmp.c'\" \(99 characters\) sed "s/^X//" >'bcmp.c' <<'END_OF_FILE' X#include <memory.h> Xint bcmp(char *b1, char *b2, int length) X{ X return (memcmp(b1,b2,length)); X} X END_OF_FILE if test 99 -ne `wc -c <'bcmp.c'`; then echo shar: \"'bcmp.c'\" unpacked with wrong size! fi # end of 'bcmp.c' fi if test -f 'bcopy.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bcopy.c'\" else echo shar: Extracting \"'bcopy.c'\" \(93 characters\) sed "s/^X//" >'bcopy.c' <<'END_OF_FILE' X#include <memory.h> X Xvoid bcopy(char *b1, char *b2, int length) X{ X memcpy(b2,b1,length); X} X END_OF_FILE if test 93 -ne `wc -c <'bcopy.c'`; then echo shar: \"'bcopy.c'\" unpacked with wrong size! fi # end of 'bcopy.c' fi if test -f 'bzero.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bzero.c'\" else echo shar: Extracting \"'bzero.c'\" \(93 characters\) sed "s/^X//" >'bzero.c' <<'END_OF_FILE' X#include <memory.h> Xbzero(char *b1, int length) X{ X char *r; X X r = memset(b1, 0, length); X} END_OF_FILE if test 93 -ne `wc -c <'bzero.c'`; then echo shar: \"'bzero.c'\" unpacked with wrong size! fi # end of 'bzero.c' fi if test -f 'rindex.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rindex.c'\" else echo shar: Extracting \"'rindex.c'\" \(143 characters\) sed "s/^X//" >'rindex.c' <<'END_OF_FILE' Xchar *rindex(char *s, char c) X{ X char *r = (char *) 0; X char *t; X X for (t = s; *t != '\0'; t++) { X if (*t==c) r = t; X } X return (r); X} END_OF_FILE if test 143 -ne `wc -c <'rindex.c'`; then echo shar: \"'rindex.c'\" unpacked with wrong size! fi # end of 'rindex.c' fi echo shar: End of shell archive. exit 0 -- | Ronald J. Srodawa | Internet: srodawa@vela.oakland.edu | | School of Engineering and CS | UUCP: srodawa@vela.UUCP | | Oakland University | Voice: (313) 370-2247 | | Rochester, Michigan 48309-4401 | |
ronald@robobar.co.uk (Ronald S H Khoo) (05/03/91)
srodawa@vela.acs.oakland.edu (Ron Srodawa) writes: > >/bin/ld : error: Unresolved externals: > >_rindex in file(s): > You have bumped into one of several common Berkeley BSD library routines > that are not supported in the SCO Development System. (They are included > as a part of the SCO TCP/IP Development System.) What follows is a shar > file containing my own source code which I wrote when I had the same > problem and before I had the SCO TCP/IP Development System. I can understand bzero, etc (and Henry Spencer's string library in the sources.unix archives has a re-implementation of almost all of these), but for index and rindex, wouldn't it be simpler just to add -Dindex=strchr -Drindex=strrchr to your cc command line? -- Ronald Khoo <ronald@robobar.co.uk> +44 81 991 1142 (O) +44 71 229 7741 (H)
bob@wizard.uucp (Bob Smith) (05/04/91)
In <44@hlthnt.UUCP> sginn@hlthnt.UUCP (Steve Ginn) writes: >I was recently trying to compile the above named app and everything >ran fine until it started linking and came up with the following >problems: >/bin/ld : error: Unresolved externals: >_rindex in file(s): >patch.o (patch.c) rindex() is a BSD version of strrchr(). You should be able to compile patch by adding a line like: #define rindex() strrchr() somewhere at the beginning of patch.c . -- | Bob Smith _ 835 Mammoth Rd. _ Dracut, MA 01826 _ 508-670-6712 | Path: uunet!spool.mu.edu!sdd.hp.com!caen!sharkey!wyn386!wybbs!wizard!bob