View mode: basic / threaded / horizontal-split · Log in · Help
April 17, 2008
gdc compiler/linker error
I am getting a linker error when I try to compile my code as follows:

jonathan@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
Top | Discussion index | About this forum | D home