Hi Jonathan Thanks very much for your reply. I'm sorry that I didn't provide the necessary information. > Are you using the same linker version in both cases? That might be as > significant as the compiler version. gcc 4.6.3 is running with ld 2.22 <==== Errors gcc 4.4.7 is running with ld 2.20 <==== No errors > How is EVD.o compiled? g++ -c -Wall -m32 -I/usr/include/python2.7 -I/usr/include/boost -O3 EVD.cpp -o _gnuRelease/EVD.o > At a guess, maybe because the function is declared as something like > Matrix<T>::eye(unsigned, double = 0.0) i.e. just because you pass the function > an int doesn't mean that's what the function is declared to take. You are absolutely correct, of course, eye() is defined in Matrix.h as follows: template<class T> class Matrix : public MatrixBase { public: <snip> static Matrix<T> eye( unsigned a_size, T a_scalingFactor=1.0 ) DONT_INLINE; <snip> } Does that point to the root cause of the problem? Best regards David > -----Original Message----- > From: Jonathan Wakely [mailto:jwakely.gcc@xxxxxxxxx] > Sent: 04 November 2013 15:19 > To: David Aldrich > Cc: gcc-help@xxxxxxxxxxx > Subject: Re: Template linker errors with gcc 4.6.3 > > On 4 November 2013 15:07, David Aldrich wrote: > > 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. > > Are you using the same linker version in both cases? That might be as > significant as the compiler version. > > > > 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? > > Not that I can think of. > > > 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)' > > How is EVD.o compiled? > > > 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)'. > > At a guess, maybe because the function is declared as something like > Matrix<T>::eye(unsigned, double = 0.0) i.e. just because you pass the function > an int doesn't mean that's what the function is declared to take. > > > > 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> > > It looks like every member of Matrix is missing. > > Either the file EVD.o is compiled with -fno-implicit-templates or those functions > are not defined in EVD.cpp > > Function templates must either be defined in every file that uses them or > explicitly instantiated. > > But you haven't provided nearly enough information to know what the specific > problem is in your case. > > > Click > https://www.mailcontrol.com/sr/b3FtO7ru!0fGX2PQPOmvUsrLibhXE7+ScsWHL3 > j8xK29vWTEKH!k8KB2zpygqLpOD80j2WpbjaLX0F9OzBqmnw== to report this > email as spam.