Connecting Tech Pros Worldwide Help | Site Map

extern and namespaces

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 4th, 2006, 07:25 PM
Vincent RICHOMME
Guest
 
Posts: n/a
Default extern and namespaces

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










  #2  
Old September 4th, 2006, 08:05 PM
Steve Pope
Guest
 
Posts: n/a
Default 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
  #3  
Old September 4th, 2006, 08:25 PM
Vincent RICHOMME
Guest
 
Posts: n/a
Default 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
  #4  
Old September 4th, 2006, 08:45 PM
Steve Pope
Guest
 
Posts: n/a
Default 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
  #5  
Old September 4th, 2006, 09:25 PM
Vincent RICHOMME
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.