Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved external symbol _IID / _CLSID

Tags:

c++

atl

I created a default ATL project with MSVC 2010 with a simple default ATL dialog. Then I added the second project into solution, named MyControls, where I created ATL DHTML Control with a help of Wizard. Then I placed ATL DHTML Control to ATL dialog.

Now I would like to call some methods of that ATL DHTML Control in ATL dialog's OnInitDialog function. In order to be able to make a call like:

CComPtr<IDHTMLControl> ptr;
HRESULT hr = GetDlgControl(IDC_ACTIVEX_CONTROL_DHTML
    , IID_IDHTMLControl, (void**)&ptr);

I am including the file DHTMLControl.h from MyControls project. However, I get the following errors:

  • Error 1 error LNK2001: unresolved external symbol _IID_IDHTMLControl
  • Error 2 error LNK2001: unresolved external symbol _LIBID_MyControlsLib
  • Error 3 error LNK2001: unresolved external symbol _CLSID_DHTMLControl
  • Error 4 error LNK2001: unresolved external symbol _IID_IDHTMLControlUI

Note: It appears that I am linking MyControls.lib incorrectly, however, I added MyControls.lib to Linker->Input->Additonal Dependencies & specified ../$(Configuration) in the Linker->General->Additional Library Directories.

Anyone have an idea? Thanks!

like image 450
Alex Avatar asked May 09 '13 15:05

Alex


1 Answers

The problem is related to how you link one project with the other. There is something missing here and since you don't show the code, it's a pure guess only.

On control project you have a type library which, when being built, also generates files MyControls_i.h, MyControls_i.c, MyControls_p.c. I suppose that on the application project you included _i.h file which declared symbols as externals, and you did not include the _i.c file with symbols actually defined.

like image 142
Roman R. Avatar answered Nov 01 '22 23:11

Roman R.