Connecting Tech Pros Worldwide Forums | Help | Site Map

extern and namespaces

Vincent RICHOMME
Guest
 
Posts: n/a
#1: Sep 4 '06
Hi,

I have ported one class from .NET into standard C++ but I have issues
with some constant.

My class is defined lke this :

#ifndef _SYSTEMWINDOWSMOBILEPOCKETOUTLOOK_H
#define _SYSTEMWINDOWSMOBILEPOCKETOUTLOOK_H

#include "System.h"

#include <objbase.h>
#include <pimstore.h>

namespace System{
namespace WindowsMobile{
namespace PocketOutlook{

class PimItem;
class Contact;
class Appointment;
class PimItemCollection;
class ContactCollection;
class Folder;
class ContactFolder;
class OutlookSession;

...


class OutlookSession
{
public:

friend class Folder;
friend class ContactCollection;
friend class TaskCollection;

OutlookSession();
~OutlookSession();

bool get_IsLoggedIn() {return m_bLoggedIn; }


//AppointmentFolder* get_Appointments();
ContactFolder* get_Contacts();
//EmailAccountCollection* get_EmailAccounts();
//SmsAccount* get_SmsAccount();
TaskFolder* get_Tasks();

protected:

bool m_bLoggedIn;
IPOutlookAppPtr m_pPOOMApp;
Folder* m_pAppointmentFolder;
Folder* m_pContactFolder;
Folder* m_pTaskFolder;
};
} // PocketOutlook
} // WindowsMobile
} // System


#endif //_SYSTEMWINDOWSMOBILEPOCKETOUTLOOK_H


and inside my cpp :

OutlookSession::OutlookSession()
:m_bLoggedIn(false),
m_pAppointmentFolder(NULL),
m_pContactFolder(NULL),
m_pTaskFolder(NULL)

{
HRESULT hr = 0;
CLSID clsid;
LPOLESTR pProgID = L"PocketOutlook.Application";

hr = ::CoInitializeEx(NULL, 0);
hr = ::CLSIDFromProgID(pProgID,&clsid);

IPOutlookApp* l_pIOutlookApp;
hr = ::CoCreateInstance(clsid, 0, CLSCTX_INPROC_SERVER,
IID_IPOutlookApp, reinterpret_cast<void **>(&l_pIOutlookApp));

if ( SUCCEEDED(hr) )
{
if(SUCCEEDED(m_pPOOMApp->Logon(NULL)))
{
m_bLoggedIn = true;
}
}
}




I GET the error : error LNK2001: unresolved external symbol IID_IPOutlookApp


while this symbol is defined in pimstore.h as :
EXTERN_C const GUID FAR IPOutlookApp;(GUID is a struct)


I don't understand why it cannot find it?????????










Steve Pope
Guest
 
Posts: n/a
#2: Sep 4 '06

re: extern and namespaces


Vincent RICHOMME <richom.v@free.frwrote:
Quote:
I GET the error : error LNK2001: unresolved external symbol IID_IPOutlookApp
Quote:
>while this symbol is defined in pimstore.h as :
>EXTERN_C const GUID FAR IPOutlookApp;(GUID is a struct)
Quote:
>I don't understand why it cannot find it?????????
What is typical is to #define EXTERN_C to be "extern" in
all but one source file, and define it to be " " in the remaining
file. If so, possibly you are not doing this last part, and
your symbol ends up not getting defined.

Steve
Vincent RICHOMME
Guest
 
Posts: n/a
#3: Sep 4 '06

re: extern and namespaces


Steve Pope a écrit :
Quote:
Vincent RICHOMME <richom.v@free.frwrote:
>
Quote:
>I GET the error : error LNK2001: unresolved external symbol IID_IPOutlookApp
>
Quote:
>while this symbol is defined in pimstore.h as :
>EXTERN_C const GUID FAR IPOutlookApp;(GUID is a struct)
>
Quote:
>I don't understand why it cannot find it?????????
>
What is typical is to #define EXTERN_C to be "extern" in
all but one source file, and define it to be " " in the remaining
file. If so, possibly you are not doing this last part, and
your symbol ends up not getting defined.
>
Steve
EXTERN_C is defined by windows not by me
Steve Pope
Guest
 
Posts: n/a
#4: Sep 4 '06

re: extern and namespaces


Vincent RICHOMME <richom.v@free.frwrote:
Quote:
>Steve Pope a écrit :
Quote:
Quote:
>What is typical is to #define EXTERN_C to be "extern" in
>all but one source file, and define it to be " " in the remaining
>file. If so, possibly you are not doing this last part, and
>your symbol ends up not getting defined.
Quote:
>EXTERN_C is defined by windows not by me
Still, the solution might be to #undef it, and #define it to " ".
However I am employing some guesswork there. You will have
to experiment to figure out exactly what's going on, and/or
find the relevant documentation on your environment, and/or take
your question to a Windows programming newsgroup rather than here.

Steve
Vincent RICHOMME
Guest
 
Posts: n/a
#5: Sep 4 '06

re: extern and namespaces


Steve Pope a écrit :
Quote:
Vincent RICHOMME <richom.v@free.frwrote:
>
Quote:
>Steve Pope a écrit :
>
Quote:
Quote:
>>What is typical is to #define EXTERN_C to be "extern" in
>>all but one source file, and define it to be " " in the remaining
>>file. If so, possibly you are not doing this last part, and
>>your symbol ends up not getting defined.
>
Quote:
>EXTERN_C is defined by windows not by me
>
Still, the solution might be to #undef it, and #define it to " ".
However I am employing some guesswork there. You will have
to experiment to figure out exactly what's going on, and/or
find the relevant documentation on your environment, and/or take
your question to a Windows programming newsgroup rather than here.
>
Steve
Yes you're right.
Thanks anyway
Closed Thread