Simple program fails to link - what am I doing wrong?
Denis Koroskin
2korden at gmail.com
Thu Nov 12 09:25:03 PST 2009
On Thu, 12 Nov 2009 20:22:56 +0300, Mike Hearn <mike at plan99.net> wrote:
> I have a feeling this is a real simple problem. What does
> _D4test7MyClass1bMFZv demangle to?
>
> class MyClass {
> int a;
> void b();
> }
>
>
> int main() {
> MyClass c;
> return 0;
> }
>
> $ dmd -v -run test.d
> parse test
> importall test
> import
> object (/home/hearn/d/dmd2/linux/bin/../../src/druntime/import/object.di)
> semantic test
> semantic2 test
> semantic3 test
> code test
> function main
> gcc test.o -o test -m32 -Xlinker -L/home/hearn/d/dmd2/linux/bin/../lib
> -lphobos2 -lpthread -lm
> test.o:(.rodata+0x34): undefined reference to `_D4test7MyClass1bMFZv'
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
Function MyClass.b is not implemented (but is referenced, because it is
put into a virtual function table).
More information about the Digitalmars-d
mailing list