0

I have a utility that I need to run on a Windows 2000 machine. It includes <comadmin.h> In Visual Studio 2019 it compiles fine and I didn't need to specify any additional .lib files. I removed all C++11 & later code and the compilation completes but fails at linking. In VC++6 on Windows XP with Windows Server 2003 SP1 Platform SDK get the following error:

ComPlus.obj : error LNK2001: unresolved external symbol _IID_ICatalogObject
ComPlus.obj : error LNK2001: unresolved external symbol _IID_ICatalogCollection
ComPlus.obj : error LNK2001: unresolved external symbol _CLSID_COMAdminCatalog
Debug/ComPlus.exe : fatal error LNK1120: 3 unresolved externals

I've tried including comsupp.lib and comsvcs.lib but this didn't help. Example code:

CComQIPtr <ICOMAdminCatalog> pCatalog;
  HRESULT hr = pCatalog.CoCreateInstance(CLSID_COMAdminCatalog);

The platform SDK documentation specifies:

Platforms: Windows 2000, Windows XP, Windows Server 2003

Header: Declared in comadmin.h

Library: Included as a resource in comadmin.dll

Tried to specify comadmin.dll as a library but advised it was wrong format. The DLL has a TYPELIB resource like this:

enter image description here

What config is required to use this or does it have to be coded differently against this older SDK?

Malcolm McCaffery
  • 2,468
  • 1
  • 22
  • 43
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Ken White Apr 11 '23 at 01:31

1 Answers1

0

The issue is the Platform SDK documentation doesn't seem to reference correct lib file to include.

I had to include SvcGuid.Lib with

#pragma comment(lib, "SvcGuid.Lib")

However, debug build does not work as VC++ 6 throws error

SvcGuid.Lib(iid.obj) : fatal error LNK1103: debugging information corrupt; recompile module

Although release build works find with this lib included.

Malcolm McCaffery
  • 2,468
  • 1
  • 22
  • 43
  • 1
    The .PDB file tormat (the file that contains debugging symbolic information) changed quite a while ago, I think in VS 2003 or thereabouts. It sounds like the DLL uses the new file format, VS6 is finding the PDB for that DLL, and it cannot load it because it doesn’t know about the newer file format. You cannot debug with symbols in VC6 a DLL compiled with a non-ancient version of VC++. If you manage to hide the PDB from VC6, it should load but you won’t have symbolic information about it. But of course you’re inviting all kinds of problems by trying to use VC6. Try to use something newer. – Euro Micelli Apr 27 '23 at 23:22
  • Good info. The only reason I use VC6 is because I'm migrating VC6 applications to modern platforms and in some cases need to isolate compat bugs using the legacy tools, but definitely wouldn't be my first choice for development today – Malcolm McCaffery May 03 '23 at 08:46