Undefined reference to '_ctype_'

J. Johnston jjohnstn@redhat.com
Fri Oct 18 11:38:00 GMT 2002

Doug Broadwell wrote:
> Hi,
> I'm getting an "Undefined reference to _ctype_ " error in various newlib
> files (e.g., .../libc/stdio/vfscanf.c) on code using the "isspace()" family
> of functions/macros.  My command line is:
> $GCCBIN/m68k-coff-gcc -nostartfiles -O0 -m68000 -msoft-float -fno-builtin -X
> linker -T -Xlinker \
> ./proto.ld -o so_monitor.coff main.c stubs.c so_monitor.c \
> $GCCBASE/m68k-coff/lib/m68000/libc.a
> Thanks,
> Doug Broadwell

This symbol should be in your libc.a, brought in by the libc/ctype/ctype_.c file.
Can you provide some more details about the error message?

This may be a problem due to the code added to support negative ctype
indexes.  One of the gcc folks warned us a while back that what we were doing
is illegal C.  Take a look at your build_directory/m68k-coff/m68000/newlib/libc/ctype.
There should be a file ctype_.o and if you do a m68k-coff-nm on that file you
should see an externally visible _ctype_ symbol.  If you don't see the symbol, try 
adding #define COMPACT_CTYPE at the top of your src/newlib/libc/ctype/ctype_.c file 
and rebuilding.

--  Jeff J.

More information about the Newlib mailing list