extern and namespaces

  • Thread starter Vincent RICHOMME
  • Start date
V

Vincent RICHOMME

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?????????
 
S

Steve Pope

Vincent RICHOMME said:
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?????????

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
 
V

Vincent RICHOMME

Steve Pope a écrit :
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
 
S

Steve Pope

Vincent RICHOMME said:
Steve Pope a écrit :
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
 
V

Vincent RICHOMME

Steve Pope a écrit :
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top