This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Template linker errors with gcc 4.6.3
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: David Aldrich <David dot Aldrich at emea dot nec dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 4 Nov 2013 16:18:01 +0000
- Subject: Re: Template linker errors with gcc 4.6.3
- Authentication-results: sourceware.org; auth=none
- References: <41302A7145AC054FA7A96CFD03835A0A0B7A0BB8 at EX10MBX02 dot EU dot NEC dot COM> <CAH6eHdRvY4b6DZW0Ex2C-vSLaCZiczGN1jej+g_RPP3Ly4iPEg at mail dot gmail dot com> <41302A7145AC054FA7A96CFD03835A0A0B7A0BF2 at EX10MBX02 dot EU dot NEC dot COM> <CAH6eHdT9yWmKaiocWz-TytMO-zFYnfKiM6EnQTvkSG2HsJO6mQ at mail dot gmail dot com> <41302A7145AC054FA7A96CFD03835A0A0B7A0C3E at EX10MBX02 dot EU dot NEC dot COM> <CAH6eHdQbLG2b7CUNbChh5epD0YBK7+7pXOU=Ud+MUh3iTuAzJA at mail dot gmail dot com> <41302A7145AC054FA7A96CFD03835A0A0B7A0C96 at EX10MBX02 dot EU dot NEC dot COM>
On 4 November 2013 16:08, David Aldrich wrote:
> Hi
>
>> Are your function templates defined in the headers that EVD.cpp includes?
>
> Yes, EVD.cpp includes:
>
> #include "Matrix.h"
>
> and Matrix.h contains:
>
> template<class T> class Matrix : public MatrixBase {
> public:
> <snip>
> static Matrix<T> eye( unsigned a_size, T a_scalingFactor=1.0 ) DONT_INLINE;
> <snip>
> }
Then that's the problem. As I said, function templates must be
defined in every file that uses them, or explicitly instantiated.
I don't know why your code worked previously, it looks invalid (if you
don't have explicit instantiations in some other file.)