0

I'm using a library in a certain IDE and I'm getting Unresolved external Symbol but I can't find out where the error is.

I've got this working fine:

pObPanel panel = ObPanelAPI::GetPanelByName("*Current"); //Gets a panel object
HWND hPanel = panel->hHandle(); //Gets an HWND from the panel object

But then I get the error when calling to this:

pObCtrl ctrl = panel->pGetChildControlByHandle(hwnd);

The error:

LINK : error LNK2019: external symbol "public: class ObCtrl * __thiscall ObPanel::pGetChildControlByHandle(struct HWND__ *)" (?pGetChildControlByHandle@ObPanel@@QAEPAVObCtrl@@PAUHWND__@@@Z) unresolved which is in the function "public: static int __stdcall jmmvHwnd::EnumProc(struct HWND__ *,long)" (?EnumProc@jmmvHwnd@@SGHPAUHWND__@@J@Z)

This is the Header file where the Class is:

class ObPanel: public ObCtrObj, public ObStateWin, public ObEvtHandler{
    ...
protected:
    ...
public:
    ...
protected:
    ...
public:
    ...                           
    HWND OBEXPORT hHandle();
    ...
    pObCtrl pGetChildControlByHandle( HWND h_wnd );
    ...
public:
    ...
protected:
    ...
public:
    ...
};

hHandle() works
pGetChildControlByHandle() error

Why?

ProtectedVoid
  • 1,293
  • 3
  • 17
  • 42
  • Because you did not implement pGetChildControlByHandle and Export it from your library. – Werner Henze Jul 22 '15 at 14:20
  • That's a linker error, not a compiler error. It happens when you are using (referencing) an identifier (function) that might be *declared* in the headers you are *including*, but is not *defined* in the libraries you are *linking* to. Check your link settings. – DevSolar Jul 22 '15 at 14:20
  • How can I fix the link error? That's my question. I know that the error is a Compiler "Link Error". Thanks. – ProtectedVoid Jul 22 '15 at 14:26
  • @ProtectedVoid: That depends on information you did not provide. If the class you are describing (`ObPanel`) is part of a third-party library, you need to link to that library. (How you do that is depending on the IDE you are using, the name of which you also did not share with us.) If that class is something you wrote yourself, you seem to be missing the *implementation* for the function mentioned in the error (`pGetChildControlByHandle`), or you are -- again -- not linking in the library / object file containing that implementation. – DevSolar Jul 22 '15 at 14:29
  • I'm calling to two functions which are in the same Header, with the same protection. I just called the function that works the same way I called the one that throws the error. The library is linked otherwise none would work. You mean the function that throws error is not implemented? Sorry for not understanding it. Thanks. – ProtectedVoid Jul 22 '15 at 14:37
  • @ProtectedVoid: *Please* do study the question (and answer) I marked your question a duplicate of. *Everything* I could tell you *is* explained therein. – DevSolar Jul 22 '15 at 14:45

0 Answers0