[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More information about inline function "used but never defined" erro
From: |
Paul Pluzhnikov |
Subject: |
Re: More information about inline function "used but never defined" error? |
Date: |
15 Feb 2005 07:56:59 -0800 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
john.pye@gmail.com (John Pye) writes:
> // only defined for unitless types
template <> // missing, required:
// units.h:104: error: explicit specialization of
// `Units<0, 0, 0, 0, 0>::operator double() const' must be
introduced by `template <>'
> inline Units<0,0,0,0,0>::operator double() const {
> return d_val;
> }
FWIW, your code compiles cleanly with gcc-3.2, 3.4.0, 3.4.3 and
(after the fix above) gcc-4.0-20040919.
It does not however link with any of them:
/tmp/ccONzY0L.o: In function `main':
/tmp/ccONzY0L.o(.text+0x62): undefined reference to `Units<0, 0, 0, 1,
0>::operator double() const'
> I would like to get some more information from the compiler about
> where this call is coming from, rather than just where the definition
> is lacking.
Well, the message above says the call is coming from 'main()',
and it is quite clear that it is coming from this line:
double upsilon = T + 13.5 / (T - 23.5);
which can be alternatively written as (and is translated by the
compiler as):
double upsilon = (double)T + (13.5 / ((double)T - 23.5)); // or
double upsilon = T.operator double() + (13.5 / (T.operator double() -
23.5));
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.