求助:Error C2511,一个很奇怪的问题。大侠们给个提示,谢谢!

时间:2021-03-11 14:14:50
说一下问题的现象:

本来一切正常,向视图类加入#include "CMPJPEGCodec.h"后,编译提示:
coolmpexview.cpp(709) : error C2511: 'my_SetBMPINFO' : overloaded member function 'void (struct tagBITMAPINFOHEADER *,long,long,int,unsigned short,int)' not found in 'CCoolMPExView'
        e:\work\2007-12\coolmpex\coolmpexview.h(16) : see declaration of 'CCoolMPExView'

把这个头文件去掉后,又没问题了。我检查了,没有拼写等低级错误。

btw,这个头文件在doc类里include了一次,没有发现错误。

很是怪异,看半天了,没有一点头绪,哥几个帮忙分析一下。谢谢!

4 个解决方案

#1


文件包含的问题,看看CMPJPEGCodec.h和CCoolMPExView是不是有相同的结构或者函数引起冲突。
或者包含顺序改变一下

#2


错误说得很明白了,你的'CCoolMPExView' 类中没有定义这个成员函数,或者定义了的这个函数参数与cpp中的参数不一样导致。

'identifier' : overloaded member function not found in 'class'

The specified function was not declared for the given parameters. In all the versions of the overloaded function, none of them had the same parameters in the same order as specified in the erroneous function call.

This error can be caused by a mismatch in the parameter list of the specified function.

解决方法:
Ensure that the correct arguments are being passed when calling the function.

Make sure the arguments are in the correct order when calling the function.
对比检查函数中参数的顺序是否和定义时候的一样。
Make sure the argument names are spelled correctly. 
对比检查函数的拼写是否正确。

还有,你这个CMPJPEGCodec.h是做什么的?

#3


my_SetBMPINFO函数在CCoolMPExView类中没定义。
看看你的返回值类型是否一样。
缺省的情况是int,不是void

#4


BITMAPINFOHEADER 这个结构体的声明或定义有冲突,可能在两个地方声明了,但是没定义或定义的不一样。

#1


文件包含的问题,看看CMPJPEGCodec.h和CCoolMPExView是不是有相同的结构或者函数引起冲突。
或者包含顺序改变一下

#2


错误说得很明白了,你的'CCoolMPExView' 类中没有定义这个成员函数,或者定义了的这个函数参数与cpp中的参数不一样导致。

'identifier' : overloaded member function not found in 'class'

The specified function was not declared for the given parameters. In all the versions of the overloaded function, none of them had the same parameters in the same order as specified in the erroneous function call.

This error can be caused by a mismatch in the parameter list of the specified function.

解决方法:
Ensure that the correct arguments are being passed when calling the function.

Make sure the arguments are in the correct order when calling the function.
对比检查函数中参数的顺序是否和定义时候的一样。
Make sure the argument names are spelled correctly. 
对比检查函数的拼写是否正确。

还有,你这个CMPJPEGCodec.h是做什么的?

#3


my_SetBMPINFO函数在CCoolMPExView类中没定义。
看看你的返回值类型是否一样。
缺省的情况是int,不是void

#4


BITMAPINFOHEADER 这个结构体的声明或定义有冲突,可能在两个地方声明了,但是没定义或定义的不一样。