link errors with 0.149, templates, and writefln

Kevin Bealer Kevin_member at pathlink.com
Mon Mar 13 22:32:14 PST 2006


In article <agqfe3-uh8.ln1 at birke.kuehne.cn>, Thomas Kuehne says...
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Kevin Bealer schrieb am 2006-03-13:
>> NOTE: this is on a 64 bit machine in Linux, so I need to manually link with gcc
>> using a slight variant of the "gcc" command that dmd uses.  I can provide more
>> data on this if needed.
>
>Hint: add "-L-m32" do the dmd command line.
>
>If your system needs gcc32:
>1) create a new dir
>2) add the file "gcc" with the the following content to the new dir
>
>#!/bin/bash
>gcc32 $*
>
>3) prepend the new dir to your path when you call dmd
>
>PATH=/the_new_dir:$PATH dmd ...
>
>Thomas
>

Thank you; I have tried this, and it didn't work.  Although, I don't know
whether I need gcc32 or indeed what it is for.  But the following Makefile is
what I am using to build instead, and it seems to work fine.

>> Makefile
: # Makefile
: 
: # Project configuration
: 
: OBJ=hello.o
: D_OPTS=-debug -g
: BINARY=hello
: 
: 
: # Machinery
: 
: D_LIBS=-lphobos -lpthread -lm
: C_OPTS=-m32
: 
: TARGET: ${BINARY}
: 
: ${BINARY}: ${OBJ}
: 	gcc ${OBJ} -o $@ ${C_OPTS} ${D_LIBS}
: 
: clean:
: 	rm -vf ${BINARY} *.o
: 
: %.o: %.d ${SRC}
: 	dmd -c ${D_OPTS} $^
: 

This works fine for most of my D projects, but unless there is link time magic
in DMD for template instantiations, I don't think this is directly connected to
the linking issue I was reporting.  Some C++ compilers have such a thing but I
don't know if DMD does.

Thanks,
Kevin





More information about the Digitalmars-d-bugs mailing list