ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option

Mathieu Malaterre mmalater@nycap.rr.com
Mon Jun 6 21:06:00 GMT 2005


Hello,

    I have a question about a valid C code. I am trying to compile the 
following code in MacOSX (*). I don't understand what the problem is ? 
Could someone please explain me what is going on ? Since I declare the 
variable with extern I should not need to pass -fno-common, right ?

Thanks for your help
Mathieu

foo.h:
extern int bar[];

foo.c:
int bar[4 * 256];

And compile lines are:
$ gcc -o foo.o   -Wall -W -fPIC    -c foo.c
$ gcc -dynamiclib   -o libfoo.dylib foo.o
ld: common symbols not allowed with MH_DYLIB output format with the 
-multi_module option
foo.o definition of common _bar (size 4096)
/usr/bin/libtool: internal link edit command failed

using gcc 3.3 20030304 (Apple Computer, Inc. build 1671)



More information about the Gcc mailing list