Solution for POOM Linker Error

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: