I've got some perfectly lovely C99 codes that are compiled from multiple .c files, and when I compile with Clang 2.7, I get some very strange errors:
/usr/include/bits/stdio.h:77: multiple definition of `putchar'
a2test.o:/usr/include/bits/stdio.h:77: first defined here
What's happening is that the GNU libc header file for <stdio.h>
declares certain functions, including putchar
, to be extern __inline__
, and for some reason clang is putting definitions into the .o
files. Then when the linker sees the duplicate definitions, it bleats.
I suspect a configuration problem: when I use the clang 2.7 that ships with Debian lenny, everything compiles. But for the class I'm teaching, software has to run on Red Hat Enterprise Linux 5, and my sysadmin has built clang 2.7 from source. (We're not using 2.9 because we couldn't get it to compile hello world, and we're not using a later version because we couldn't get the latest to build.)
I am looking for a workaround that will allow me to compile. Either a command-line option or a way to reconfigure clang so it doesn't do this bad thing.
I have already tried -U__USE_EXTERN_INLINES
with no effect.