duplicate symbol linker errors, my fault or D's?

Zach the Mystic reachMINUSTHISzachgmail at dot.com
Mon Mar 5 16:04:08 PST 2012


I'm not sure if the linker errors I'm getting are my fault or D's.

I'm trying to do incremental compilation since the size of my
program is starting to break my computer, slowing compilations
down by four or five times.

Suppose I have two libraries:
lib1.a
lib2.a

I build lib1 with a bunch of files. Then I build lib2 by linking
with lib1:

dmd -lib -oflib2.a ... file1.d file2.d lib1.a

Now file1 and file2 actually import a lot of the files built into
lib1, but neither is in lib1.

When I try to compile file3.d:

dmd file3.d -L-llib2
ld: duplicate symbol
_D53/Users/zach/source/dmd2/src/phobos/std/array.d.237__arrayZ in
./lib/lib2.a(array_17_e15.o) and ./lib/lib2.a(array_17_e82.o)
collect2: ld returned 1 exit status

I fear I'm not going to be able to use incremental compilation
because D is duplicating some symbols I can't track because I'm
not declaring them myself.

There's a lot of stuff I don't know about programming. Therefore
I hope I'm making a beginner's blunder instead.

What's your opinion?

Zach


More information about the Digitalmars-d-learn mailing list