gdc 12.1: undefined references when linking separately compiled files

kdevel kdevel at vogtner.de
Sat May 28 13:12:46 UTC 2022


I am trying to build a project with GDC. It successfully compiles 
with dmd and ldmd2. When I use gdc in one go the binary is 
successfully build:

```
$ gdc -o ppinsta esah.d evaluate.d jsr.d jsw.d parser.d ppinsta.d 
ptvr.d stack.d testdatagenerator.d
```

Though after compiling separately the linking fails:

```
$ make -f Makefile.gdc -j3
gdc -o ppinsta.o -c ppinsta.d
gdc -o esah.o -c esah.d
gdc -o evaluate.o -c evaluate.d
gdc -o jsr.o -c jsr.d
gdc -o jsw.o -c jsw.d
gdc -o parser.o -c parser.d
gdc -o ptvr.o -c ptvr.d
gdc -o stack.o -c stack.d
gdc -o testdatagenerator.o -c testdatagenerator.d
gdc -o ppinsta ppinsta.o esah.o evaluate.o jsr.o jsw.o parser.o 
ptvr.o stack.o testdatagenerator.o
ppinsta.o: In function 
`_D3std6format8internal5write__T8getWidthTAyaZQoFNaNfQlZl':
ppinsta.d:(.text+0x1c5a): undefined reference to 
`_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAyaZQoFQhZ9__lambda2Z__TQCpTQBcZQCxMFNaNfQBpZb'
ppinsta.o: In function 
`_D3std6format8internal5write__T20formatValueImplUlongTSQCb5array__T8AppenderTAyaZQoTaZQCdFNaNfKQBpmIbMKxSQDzQDy4spec__T10FormatSpecTaZQpZv':
ppinsta.d:(.text+0x2bcc): undefined reference to 
`_D3std9algorithm9searching__T3allSQBg6format8internal5write__T20formatValueImplUlongTSQDg5array__T8AppenderTAyaZQoTaZQCdFKQBlmIbMKxSQFaQDu4spec__T10FormatSpecTaZQpZ10__lambda16Z__TQFvTAaZQGcMFNaNfQmZb'
ppinsta.d:(.text+0x2c5b): undefined reference to 
`_D3std9algorithm9searching__T3allSQBg6format8internal5write__T20formatValueImplUlongTSQDg5array__T8AppenderTAyaZQoTaZQCdFKQBlmIbMKxSQFaQDu4spec__T10FormatSpecTaZQpZ10__lambda17Z__TQFvTAaZQGcMFNaNfQmZb'
collect2: error: ld returned 1 exit status
make: *** [ppinsta] Error 1
```

Any ideas?


More information about the Digitalmars-d-learn mailing list