I have wonderful C99 codes that are compiled from multiple .c files, and when I compile Clang 2.7, I get 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 happens is that the GNU libc header for <stdio.h> declares certain functions, including putchar , like extern __inline__ , and for some reason clang puts the definitions in .o files. Then, when the linker sees duplicate definitions, it fades.
I suspect a configuration problem: when I use clang 2.7, which comes with Debian lenny, everything compiles. But for the class I'm teaching, the software should run on Red Hat Enterprise Linux 5, and my sysadmin created clang 2.7 from the source code. (We don’t use 2.9 because we couldn’t get him to compile hello world, and we don’t use a later version because we couldn’t compile the latest version.)
I am looking for a workaround that will allow me to compile. Either a command line option, or a way to reconfigure clang so that it doesn't do it badly.
I already tried -U__USE_EXTERN_INLINES without effect.
glibc clang
Norman ramsey
source share