Bear35645
Bear35645

Reputation: 213

error: C2988: unrecognizable template declaration/definition

I get the error in the title on two of my templates. Both have similar declarations and definitions as follows:

template <typename T1, typename T2> void setVideoCodecOption(T1 AVCodecContext::*option, T2 (CR2CVideoCodecSettings::*f)() const);

template <typename T1, typename T2>
void EncoderPrivate::setVideoCodecOption(T1 AVCodecContext::*option, (CR2CVideoCodecSettings::*f)() const)
{
    T2 value = (m_videoSettings.*f)();
    if (value != -1) {
        m_videoCodecContext->*option = (m_videoSettings.*f)();
    }
}

I don't understand why I am getting this error on these. Anyone have and idea?

Thanks, Bear

Upvotes: 7

Views: 13016

Answers (1)

NathanOliver
NathanOliver

Reputation: 180490

You are missing the return type of the function parameter of the second function.

template <typename T1, typename T2>
void EncoderPrivate::setVideoCodecOption(T1 AVCodecContext::*option, (CR2CVideoCodecSettings::*f)() const)

Should be

template <typename T1, typename T2>
void EncoderPrivate::setVideoCodecOption(T1 AVCodecContext::*option, T2 (CR2CVideoCodecSettings::*f)() const)
                                                                     ^^^added return type

Upvotes: 5

Related Questions