Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get a "member function not present" error when evaluating expressions on the VC++ debugger?

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.

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

Why is that?

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.

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);
}

and it is invoked like this:

MyClass::getDirectory ()

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

like image 748
Pedro d'Aquino Avatar asked Jun 26 '09 22:06

Pedro d'Aquino


1 Answers

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()
like image 135
Pedro d'Aquino Avatar answered Oct 07 '22 11:10

Pedro d'Aquino