what does quot;error : a nonstatic member reference must be relative to a specific objectquot; mean?(“错误:非静态成员引用必须与特定对象相关是什么意思?意思是?)
问题描述
int CPMSifDlg::EncodeAndSend(char *firstName, char *lastName, char *roomNumber, char *userId, char *userFirstName, char *userLastName)
{
...
return 1;
}
extern "C"
{
__declspec(dllexport) int start(char *firstName, char *lastName, char *roomNumber, char *userId, char *userFirstName, char *userLastName)
{
return CPMSifDlg::EncodeAndSend(firstName, lastName, roomNumber, userId, userFirstName, userLastName);
}
}
在线 return CPMSifDlg::EncodeAndSend 我有一个错误:错误:非静态成员引用必须与特定对象相关.
On line return CPMSifDlg::EncodeAndSend I have an error :
Error : a nonstatic member reference must be relative to a specific object.
什么意思?
推荐答案
EncodeAndSend 不是静态函数,这意味着它可以在 CPMSifDlg.你不能这样写:
EncodeAndSend is not a static function, which means it can be called on an instance of the class CPMSifDlg. You cannot write this:
CPMSifDlg::EncodeAndSend(/*...*/); //wrong - EncodeAndSend is not static
它应该被称为:
CPMSifDlg dlg; //create instance, assuming it has default constructor!
dlg.EncodeAndSend(/*...*/); //correct
这篇关于“错误:非静态成员引用必须与特定对象相关"是什么意思?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“错误:非静态成员引用必须与特定对象相关"是什么意思?意思是?
基础教程推荐
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
