Template linker errors with gcc 4.6.3
David Aldrich
David.Aldrich@EMEA.NEC.COM
Mon Nov 4 15:07:00 GMT 2013
Hi
We have a mature project that builds fine with gcc 4.4, but when we build it with gcc 4.6.3 on Ubuntu 12.04 LTS we get linker errors that are related to templates.
I am finding it difficult to understand the errors. As a general question, was template processing significantly changed between gcc 4.4 and 4.6 in a way that might cause linker errors?
Here is an example of an error that I am getting:
+ make
g++ -o _gnuRelease/myapp -Wl,-whole-archive,-export-dynamic ../Kernel/_gnuRelease/libKernel.a -lboost_python-mt-py27 -lpython2.7 -Wl,--no-whole-archive -ldl
../Kernel/_gnuRelease/libKernel.a(EVD.o): In function `eigSymmetric(Matrix<double> const&, Matrix<double>&, Matrix<double>&, unsigned int)':
EVD.cpp:(.text+0x25a): undefined reference to `Matrix<double>::eye(unsigned int, double)'
Now, the only line of code in eigSymmetric() that calls eye() is:
int N = a_X.numRows();
...
a_V = Matrix<double>::eye(N);
so I don't understand why the linker is looking for `Matrix<double>::eye(unsigned int, double)' rather than for `Matrix<double>::eye(int)'.
There are also many other errors:
EVD.cpp:(.text+0x1c6e): undefined reference to `Matrix<std::complex<double> >::Matrix()'
EVD.cpp:(.text+0x1c7d): undefined reference to `Matrix<double>::Matrix()'
EVD.cpp:(.text+0x1f9e): undefined reference to `Matrix<std::complex<double> >::Matrix(unsigned int, unsigned int, std::vector<std::complex<double>, std::allocator<std::complex<double> > > const&, MatrixConst::EOrdering)'
EVD.cpp:(.text+0x1fe5): undefined reference to `Matrix<std::complex<double> > operator*<std::complex<double> >(Matrix<std::complex<double> > const&, Matrix<std::complex<double> > const&)'
EVD.cpp:(.text+0x2006): undefined reference to `Matrix<std::complex<double> > operator-<std::complex<double> >(Matrix<std::complex<double> > const&, Matrix<std::complex<double> > const&)'
EVD.cpp:(.text+0x2080): undefined reference to `Matrix<std::complex<double> >::frob2() const'
<snip>
Any help would be much appreciated.
Best regards
David
More information about the Gcc-help
mailing list