Displaying Draft folder messages Link Error

Login to reply to this topic.
Wed, 2006-04-12 07:52
Joined: 2005-12-04
Forum posts: 75
Hi , I'm trying to display all the messages in a draft folder Using the following method in the application engine:
#include <badesca.h>
#include <e32des8.h>
#include <e32des16.h>
#include "MyEmailEngine.h"
///----->Getting The Draft Folder Of Sms Messages
void CMyEmailEngine :: GetAllMessagesFromSystemDraftFolderL(CDesCArray& tempMess)
{ _LIT(KDraftString,"\t%S");
TBuf<2000> aDraftString;
TBuf<1000> tempBuf;//iMsvSession
////CMsvEntry* entry = iSession->GetEntryL(KMsvDraftEntryId);
CMsvEntry* entry = iMsvSession->GetEntryL(KMsvDraftEntryId);
CleanupStack::PushL(entry);
CMsvEntrySelection* entries = entry->ChildrenL();
CleanupStack::PopAndDestroy(entry) ;
//entry = NULL ;
TInt nCount = entries->Count();
for(TInt index = 0; index < nCount; index++)
{
TMsvId entryID = entries->At(index);
//entry = iSession->GetEntryL(entryID);
entry = iMsvSession->GetEntryL(entryID);
CleanupStack::PushL(entry);
TMsvEntry msvEntry = entry->Entry();
TPtrC nn = msvEntry.iDescription;
tempBuf.Zero();
tempBuf.Format(_L("%S"),&nn);
tempLength = tempBuf.Length(); //always 60 if message is more than 60 characters
aDraftString.Format(KDraftString(),&tempBuf);
tempMess.AppendL(aDraftString);
CleanupStack::PopAndDestroy(entry); // entry
}
}
///----->End
When I compile the project it gives the following Link error:
Linking...
Creating library C:\Symbian\7.0s\Series60_v20\\Epoc32\release\wins\udeb\z\\system\apps\InternetEmail\InternetEmail.lib and object C:\Symbian\7.0s\Series60_v20\\Epoc32\release\wins\udeb\z\\system\apps\InternetEmail\InternetEmail.exp
InternetEmailEngine.obj : error LNK2019: unresolved external symbol __chkstk referenced in function "public: void __thiscall CInternetEmailEngine::GetAllMessagesFromSystemDraftFolderL(class CDesC16Array &)" (?GetAllMessagesFromSystemDraftFolderL@CInternetEmailEngine@@QAEXAAVCDesC16Array@@@Z)
C:\Symbian\7.0s\Series60_v20\\Epoc32\release\wins\udeb\z\\system\apps\InternetEmail\InternetEmail.app : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Symbian\7.0s\Series60_v20\Series60Ex\InternetEmail\Deb_S60_20_WINS\BuildLog.htm"
InternetEmail - 2 error(s), 4 warning(s)

Although that I included all the libraries + Headers needed for the project (method) but still the error continued, when I comment on the method every thing on the project goes successfully which assures that the problem coming from the method(GetAllMessagesFromSystemDraftFolderL).

Here Is the (mmp) file of the project:

TARGET MyEmail.app
TARGETTYPE app
UID 0x100039CE 0x101FF1C8
TARGETPATH \system\apps\MyEmail
SOURCEPATH ..\data
RESOURCE MyEmail.rss
RESOURCE MyEmail_caption.rss

SOURCEPATH ..\src
SOURCE MyEmailApp.cpp
SOURCE MyEmailAppUi.cpp
SOURCE MyEmailDocument.cpp
SOURCE MyEmailContainer.cpp
SOURCE MyEmailEngine.cpp

LANG SC
USERINCLUDE .
USERINCLUDE ..\inc
SYSTEMINCLUDE .
SYSTEMINCLUDE \epoc32\include
LIBRARY bafl.lib
LIBRARY euser.lib
LIBRARY apparc.lib
LIBRARY cone.lib
LIBRARY eikcore.lib
LIBRARY eikcoctl.lib
LIBRARY avkon.lib
LIBRARY commonengine.lib
LIBRARY msgs.lib
LIBRARY mtur.lib
// [-] LIBRARY edll.lib
AIF MyEmail.aif ..\aif MyEmailaif.rss c8 context_pane_icon.bmp context_pane_icon_mask.bmp list_icon.bmp list_icon_mask.bmp
Here Is also The Header File Of the project:
// INCLUDES
#include <e32des8.h>
#include <e32des16.h>
///
#include <e32std.h>
#include <e32base.h>
#include <msvapi.h> //of MsvSession
#include <msvstd.h>
#include <imapset.h>
#include <pop3set.h>
#include <msvfind.h>
#include <msventry.h>
#include <msvids.h>
#include <mtclreg.h> // for CClientMtmRegistry
#include <mtclbase.h> // for CBaseMtm
#include <mtmuibas.h> // for CBaseMtmUi
#include <mtuireg.h> // for CMtmUiRegistry
#include <miutset.h>

#include <popcmtm.h> // for POP( commmands )
#include <impcmtm.h> // for IMAP( commands )
#include <badesca.h>
#include <badesca.h> //CdesArray
#include "internetemail.hrh"

// FORWARD DECLARATIONS

// CONSTANTS

// not needed in one protocol implementation
enum TProtocolType
{
EProtocolNULL,
EProtocolPop3,
EProtocolImap4
};

enum TInternetEmailEngineEvent
{
ERemoteCountChanged,
};

// CLASS DECLARATION

/*
* */

class MMyEmailEngineObserver
{
public:
virtual void HandleEngineChangedEventL(TInternetEmailEngineEvent aEvent)=0;
};
/*
* */
class CMyEmailEngine : public CActive, public MMsvSessionObserver
{
public: // // Constructors and destructor
static CInternetEmailEngine* NewL(MInternetEmailEngineObserver& aObserver);
//static CInternetEmailEngine* NewLC();
~CInternetEmailEngine();

public: // New functions
// MAIN USER API

/*
* RemoteOpenEmailL(TInt aIndex)
*
* Uses generic messaging architecture and opens selected message entry.
* May generate dial-up connection to fetch message body.
*
* @param TInt aIndex index to message entry to be opened
*
*/
void RemoteOpenEmailL( const TInt aIndex);

/*
* void RemoteFetchL()
*
* Initiates remote mailbox fetch process
*
*/
void RemoteFetchL();

/*
* void SetProtocolL( const TInt aType );
*
* @param TInt aType type enumeration of selected type
*/
void SetProtocolL( const TInt aType ); // not needed in one protocol implementation
TBool IsProtocolSet(); // not needed in one protocol implementation

// For view handling( see InternetEmailContainer )
TPtrC RemoteEmailTextL( const TInt aIndex);
TPtrC RemoteEmailSenderL( const TInt aIndex);
TInt RemoteEmailCount();
void GetAllMessagesFromSystemDraftFolderL(CDesCArray& tempMess);
TBool IsEngineReady();
/*
* TBool CheckIfExistsL( const TInt typeenum )
* Checks if service entry( Email settings ) exists for
* given internet email protocol type.
*
* @param const TInt aTypeEnum type enumeration of given protocol type
* @return TBool ETrue if protocol of given type exists
*
*/
TBool CheckIfExistsL( const TInt aTypeEnum );

void CancelOperation();
void Queue();

public: // Functions from base classes
// from CActive
void RunL();
void DoCancel();
TInt RunError( const TInt aError);

// from MMsvSessionObserver
void HandleSessionEventL(TMsvSessionEvent aEvent,TAny* aArg1,TAny* aArg2,TAny* aArg3);

// private
private:
CMyEmailEngine( MMyEmailEngineObserver& aObserver );
void ConstructL();
void CompleteConstructL();
void DisplayMessageL( const TMsvId &aId );
TMsvId FindServiceL( const TUid aType );
TMsvId FindFolderThenServiceL( const TUid aType ); // not needed in one protocol implementation
void MailCommandL( const TInt aCommand, TDes8& aParams );
void LoadMtmL();
CBaseMtm* InstantiateClientMtmL( TMsvId aService, const TUid aType );
//for update
CMsvEntrySelection* UpdateEntriesL(const TMsvId& aServiceId);
void UpdateRemoteCountL();

// private types
private:

// internal state indication
enum TInternalState
{
EInitialising,
EReadyButNeedsProtocol,
EReady,
EConnecting,
EFetching,
EDisconnecting,
EDone,
ECanceling
};

private: //Data
MMyEmailEngineObserver& iObserver; //informs ui when to react to entry changes

CMsvSession* iMsvSession; //the server session itself, our highway to kernel space
CClientMtmRegistry* iClientReg; //registry used to find client mtm of given protocol type
CMtmUiRegistry* iUiReg; //registry used to instantiante views of given mtm
CMsvOperation* iMsvOp; //long lasting email operation object, used e.g. for cancelling requests
CMsvFindOperation* iFind;
TMsvId iServiceId; //service id of either protocol used e.g. as
TMsvId iId; //id of the mailbox( POP ) or inbox( IMAP ) used as a root of messagelist
TInternalState iState; //the state of the statemachine we implement by this engine

CMsvEntrySelection* iRemoteEntries; //array of entries used also as mailcommmand argument
TInt iRemoteCount; //count of message entries in given folder or mailbox

CBaseMtm* iMtm; //abstract mtm for use of both pop and imap
CMsvEntry* iEntry; //current selected entry
////CMsvSession* iSession;
// next members not needed in one protocol implementation
TBool iIsProtocolSet; //bool if protocol has been selected by user or not?
TBool iHasImapInbox; //boot have we made folder sync and got inbox?
TInt iProtocolType; //type of selected protocol, custom enumeration
TUid iProtocolUid; //uid of selected protocol for easier abstraction
TInt tempLength;
};

#endif

I'm getting Upset Why this Error Cntinued?

Wed, 2007-05-02 12:31
Joined: 2004-05-21
Forum posts: 48
Re: Displaying Draft folder messages Link Error
The error is for huge object declared on stack...

In your case, it could be following two objects:
TBuf<2000> aDraftString;
TBuf<1000> tempBuf;//iMsvSession

You can try reducing the size of these bufs (say 100 bytes) or else if atall you need such huge objects, then create them on heap using HBuf.

Dushyant Gaur
Software Specialist,
Kodiak Networks,
No 401 Prestige Sigma, 4th Floor
3 Vittal Mallya Road
Bangalore - 560 001
India

  • Login to reply to this topic.