不能将参数 1 从“int &(__thiscall RBTree<T>::* )(RBTreeNode<T> *)”转换为“int &(__cdecl *)(RBTreeNode<T> *)”
来源:互联网 发布:网络拨号连接在哪里 编辑:程序博客网 时间:2024/05/03 19:30
因为你需要的是一个类的函数地址而不是对象的。所以必需用静态成员函数。
static
int
implement(
int
x);
//改成静态成员函数
或者友元也可以吧???
thiscall仅仅应用于“C++”成员函数。this指针存放于CX/ECX寄存器中,参数从右到左压。thiscall不是关键词,因此不能被程序员指定。
__cdeclC调用约定(即用__cdecl关键字说明)(The C default calling convention)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参数vararg的函数(如printf)只能使用该调用约定)。另外,在函数名修饰约定方面也有所不同。 _cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。VC将函数编译后会在函数名前面加上下划线前缀。
声明的话直接像下面这样就行了
1
int
__cdecl implement(
int
x);
0 0
- 不能将参数 1 从“int &(__thiscall RBTree<T>::* )(RBTreeNode<T> *)”转换为“int &(__cdecl *)(RBTreeNode<T> *)”
- C++ error C2662: “LinkNode<T> *List<T>::Locate(int)”: 不能将“this”指针从“const List<int>”转换为“List<int> &”
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- “DDX_Control” : 不能将参数 3 从“int”转换为“CWnd &”
- int offset = (int)(t*)1 - (int)(singleton *)(t*)1
- int offset = (int)(t*)1 - (int)(singleton *)(t*)1
- 关于VS2012使用make_pair编译提示“error C2664: “std::make_pair”: 不能将参数 1 从“int”转换为“int &&””
- error C2664: “int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [15]”转换为“LPTSTR”
- 不能将参数 1 从“int”转换为“std::_Vector_const_iterator<_Myvec>”(VS2010 )
- int & const t和 int const& t
- 关于int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;
- error C2664: “int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)”: 不能将参数 2 从“const char [9]”转换为“LP
- C类型转换:error C2664:不能将参数 从“int”转换为“const char *”
- System.Nullable<T> int?
- error C2664: “Student1::Student1(int,char [],int)”: 不能将参数 2 从“std::string”转换为“char []”
- MFC Edit控件 error:“DDX_Control”: 不能将参数 3 从“int”转换为“CWnd &”
- “automation服务器不能创建对象”的问题的解决方案大全 转自 射阳电信 黄德乔
- 装机必备
- svn提交异常file is scheduled for addition, but is missing
- Androidk中WebView相关
- 黑马程序员——面向对象3
- 不能将参数 1 从“int &(__thiscall RBTree<T>::* )(RBTreeNode<T> *)”转换为“int &(__cdecl *)(RBTreeNode<T> *)”
- C/C++ XMPP/Jabber 客户端类库对比/点评
- java学习——入门扫盲篇
- nginx中对recv-send的封装
- 这两年我做Discuz!插件开发的那些事(一)
- html 如何调用My97DatePicker
- JS获取当前时间戳的方法
- 【实用随记】ajax动态显示用户数
- 实践中悟出的最佳JavaScript开发