help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More information about inline function "used but never defined" error?


From: John Pye
Subject: More information about inline function "used but never defined" error?
Date: 14 Feb 2005 21:31:02 -0800

Hi there

I have a class which is giving me some trouble. I need G++ to give me
a more complete compiler error message, rather than the current
warning message.

Here is a code snippet:

    --------------------
    template< int M ,int L=0 ,int T=0 ,int K=0 ,int I=0 >
    class Units {
       ...
        // scalar typecast
        inline operator double() const;// not defined here because 
                                // only unitless can cast to double
       ...
    };
    ...
    // only defined for unitless types
    inline Units<0,0,0,0,0>::operator double() const {
        return d_val;
    }
    --------------------

You can see the above class in its entirety at 
http://cvs.sourceforge.net/viewcvs.py/freesteam/freesteam/units.h?rev=1.14&view=auto

When I try to the the first (undefined) cast to double, I get the
following compiler warning:

    ------------------
    freesteam/units.h:75: warning: inline function `Units<M, L, T, K, 
    I>::operator double() const [with int M = 1, int L = 2, int T =
    -3, int K = 0, int I = 0]' used but never defined
    ------------------

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.

Can anyone suggest a way that I can use G++ which will give me more
information about the location of this attempted cast to double?

For a more complete example that throws this error, see
http://cvs.sourceforge.net/viewcvs.py/freesteam/freesteam/units-04.cfail.cpp?rev=1.1

Cheers

JP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]