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 15:40:25 +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>
On 4 November 2013 15:34, David Aldrich wrote:
>
>> 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?
No, it just means that the compiler is correct to require
Matrix<double>::eye(unsigned int, double) instead of
Matrix<double>::eye(int)