gdc compiler/linker error

Jason House jason.james.house at gmail.com
Thu Apr 17 16:03:29 PDT 2008


Jonathan Crapuchettes wrote:

> I am getting a linker error when I try to compile my code as follows:
> 
> jonathan at blackbeard:~/workspace/ccb/matrix$ gdmd test.d Matrix.d Vector.d
> Util.d ../MySQLConnection.d -unittest -I../..
> -L/usr/lib/atlas/libptcblas.a -L/usr/lib/atlas/liblapack.a
> -L/usr/lib/atlas/libatlas.a -L/usr/lib/atlas/libcblas.a
> -L/usr/lib/atlas/libblas.a -L/usr/lib/libmysqlclient.so -vdmd
> /usr/bin/gdc -funittest -I ../.. -c test.d -o test.o
> /usr/bin/gdc -funittest -I ../.. -c Matrix.d -o Matrix.o
> /usr/bin/gdc -funittest -I ../.. -c Vector.d -o Vector.o
> /usr/bin/gdc -funittest -I ../.. -c Util.d -o Util.o
> /usr/bin/gdc -funittest -I ../.. -c ../MySQLConnection.d -o
> MySQLConnection.o /usr/bin/gdc -funittest -I ../.. test.o Matrix.o
> Vector.o Util.o MySQLConnection.o -Wl,/usr/lib/atlas/libptcblas.a
> -Wl,/usr/lib/atlas/liblapack.a -Wl,/usr/lib/atlas/libatlas.a
> -Wl,/usr/lib/atlas/libcblas.a -Wl,/usr/lib/atlas/libblas.a
> -Wl,/usr/lib/libmysqlclient.so -o test Util.o: In function
> `_D3ccb6matrix4Util11__unittest0FZv': Util.d:(.text+0x2ec4): undefined
> reference to `_D3ccb15MySQLConnection15mysqlConnection7__ClassZ'
> Util.d:(.text+0x2f22): undefined reference to
>
`_D3ccb15MySQLConnection15mysqlConnection5_ctorMFAaAaAaAaZC3ccb15MySQLConnection15mysqlConnection'
> collect2: ld returned 1 exit status
> 
> I am trying to use gdc for its 64-bit compilation, but this is a problem.
> I checked the compiled code inside MySQLConnection.o with objdump and
> found that _D3ccb15MySQLConnection15MysqlConnection7__ClassZ exists. The
> only different between this label and the one that is causing the error is
> the m in the last term. The name of the class is MysqlConnection.
> 
> I am using gdc (GCC) 4.1.3 20070831 (prerelease gdc 0.25, using dmd 1.021)
> (Ubuntu 0.25-4.1.2-16ubuntu1).
> 
> What can I do to get this is compile and link?
> 
> Thank you taking to read this,
> JC

If you pick up a d demangler and run it on the output, it'll make it easier
for others to interpret.  It may even have the unexpected side effect of
making the error obvious.


More information about the Digitalmars-d-learn mailing list