为什么我会收到“不存在成员函数"的消息?在VC ++调试器上评估表达式时出错? [英] Why do I get a "member function not present" error when evaluating expressions on the VC++ debugger?

查看:44
本文介绍了为什么我会收到“不存在成员函数"的消息?在VC ++调试器上评估表达式时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在另一个DLL MyDll.dll 上有一个静态方法 MyClass :: myMethod().在我的代码中,我调用了此方法,它可以编译并正常运行.

I've got a static method, MyClass::myMethod() on another DLL, MyDll.dll. In my code, I call this method, and it compiles and runs fine.

但是当我在直接窗口(或监视窗口)中尝试 MyClass :: myMethod()时,我总是得到:

But when I try MyClass::myMethod() in the immediate window (or the watch window), I always get:

MyClass::myMethod()
CXX0052: Error: member function not present

那是为什么?

更新:我发现当我使用

Update: I've found out that when I use the context operator it works:

{,,MyDLL}MyClass::myMethod()

不过,我不太确定为什么需要这样做,因此我将稍等一下,看看有人是否有很好的解释.

I'm not really sure why it's needed, though, so I'm going to wait a bit to see if someone has a nice explanation.

更新2 :有人要求我提供更多信息.不幸的是,我所描述的几乎是我所拥有的.这是在第三方代码中.驻留在不同DLL上的方法是这样声明的:

Update 2: I was asked to give more information. Unfortunately, what I described is almost all I have. This is in third-party code. The method, which resides on a different DLL, is declared like this:

class MyClass
{
 public:
 // ...
 _declspec(dllimport) static const char *getDirectory(void);
}

,它是这样调用的:

MyClass::getDirectory ()

我没有消息来源.它是在VC ++ 9下以调试模式编译的.

I haven't got the source. It was compiled on Debug mode under VC++9.

推荐答案

好吧,我不确定为什么,但是调试器不够聪明,无法知道该类在另一个DLL中,因此您必须明确地告诉它通过使用上下文运算符:

Well, I'm not sure why, but the debugger isn't smart enough to know that class is in another DLL, so you have to explictly tell it by using the context operator:

{,,MyDLL}MyClass::myMethod()

这篇关于为什么我会收到“不存在成员函数"的消息?在VC ++调试器上评估表达式时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆