本文介绍了为什么我得到一个“成员函数不存在”在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.

推荐答案

好吧,我不知道为什么, 't足够聪明的知道类是在另一个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 ++调试器上评估表达式时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 08:28