Solution for POOM Linker Error

April 4, 2009

I was trying to build sample code from MSDN that displays the Pocket Outlook version and demonstratesĀ  POOM initialization and basic usage on interfaces. I copied and pasted the code into a cpp file of a sample Win32 Smart device project.Ā  Expecting that I am all done, I gave a build. But the build failed and the linker threw the following error messages.

Sample.obj : error LNK2001: unresolved external symbol CLSID_Application
Sample.obj : error LNK2001: unresolved external symbol IID_IPOutlookApp

Quick google search didn’t get any useful results until I tried the following.

Solution

The solution was to replace #define INITGUID with #include <initguid.h> and the build passed.

Original Sample code from MSDN

#define INITGUIDĀ  // Replace this by #include <initguid.h>
#include <windows.h>
#include <pimstore.h>

HRESULT hr;
IPOutlookApp * polApp;

// Initialize COM for Pocket Outlook.
if (FAILED(CoInitializeEx(NULL, 0))) return FALSE;

// Get the application object.
hr = CoCreateInstance(CLSID_Application,
NULL,
CLSCTX_INPROC_SERVER,
IID_IPOutlookApp,
(LPVOID*)&polApp);
if (FAILED(hr)) return FALSE;

// Log on to Pocket Outlook.
hr = polApp->Logon(NULL);
if (FAILED(hr)) return FALSE;

// Get the version and display it in a message box.
BSTR pwszVersion = NULL;
polApp->getVersion(&pwszVersion);
MessageBox(NULL, pwszVersion, TEXT(“POOM Version”), MB_SETFOREGROUND |
MB_OK);

// Free the version string.
SysFreeString(pwszVersion);
// Note: For Palm-size PC version 1.0 use the Application method:
// polApp->SysFreeString(pwszVersion).

// Log off and release the application object.
polApp->Logoff();
polApp->Release();
return TRUE;

Advertisements