Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: C2988: unrecognizable template declaration/definition

Tags:

c++

templates

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

like image 567
Bear35645 Avatar asked Jun 09 '15 19:06

Bear35645


1 Answers

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
like image 155
NathanOliver Avatar answered Nov 09 '22 08:11

NathanOliver