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

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

问题描述

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

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天全站免登陆