beginner's linking error

Adam D. Ruppe destructionator at gmail.com
Thu Jan 17 12:38:55 UTC 2019


On Thursday, 17 January 2019 at 10:38:50 UTC, James Cranch wrote:
> An attempt to compile it looks as follows:
>
> | $ gdc executable.d -o executable

You need to pass all the modules you use to the compiler, or 
compile each one at a time and pass the resultant .o files to the 
linker together.

> | /tmp/cc4RjTlb.o:(.data.rel+0x10): undefined reference to 
> `_D7library12__ModuleInfoZ'

This just means the library module was missing from the final 
link. (if you remove the other call from it, it made the library 
do nothing and thus the compiler didn't even actually emit the 
call to it).

But try just

gdc executable.d -o executable library.d

so both .d files are on the list. That's the easiest and fastest 
way to make ti work.


More information about the Digitalmars-d-learn mailing list