EDIT: fixed, thanks for help.
I get this when I try to make the project.
Errors caused tool to abort.
Link Error : Undefined symbol: 'CMyCompoundClass::CMyCompoundClass(void) (??0CMyCompoundClass@@QAE@XZ)'
Link Error : referenced from 'class CMyCompoundClass * CMyCompoundClass::NewL(void) (?NewL@CMyCompoundClass@@SAPAV1@XZ)' in CMyCompoundClass.cpp:19
Link Error : Undefined symbol: 'CMySimpleClass::CMySimpleClass(void) (??0CMySimpleClass@@QAE@XZ)'
Link Error : referenced from 'class CMySimpleClass * CMySimpleClass::NewL(void) (?NewL@CMySimpleClass@@SAPAV1@XZ)' in CMySimpleClass.cpp:17
Link Error : Link failed
I found some answers to this problem but still dont know how to fix it, so if someone could help.
My code is following:
#include "CMySimpleClass.h"
void CMySimpleClass::ConstructL()
{
iMember = 0;
}
CMySimpleClass* CMySimpleClass::NewLC()
{
CMySimpleClass *self= new (ELeave) CMySimpleClass;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMySimpleClass* CMySimpleClass::NewL()
{
CMySimpleClass *self = new (ELeave) CMySimpleClass;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
TInt CMySimpleClass::Get()
{
return iMember;
}
void CMySimpleClass::AddInt(TInt aValue)
{
iMember = iMember + aValue;
}
###################################################
#ifndef CMySimpleClass_H
#define CMySimpleClass_H
#include <e32base.h>
class CMySimpleClassublic CBase
{
public:
CMySimpleClass();
~CMySimpleClass();
void AddInt(TInt aValue);
TInt Get();
static CMySimpleClass* NewL();
static CMySimpleClass* NewLC();
void ConstructL();
private:
TInt iMember;
};
#endif
###################################################
#include "CMyCompoundClass.h"
void CMyCompoundClass::ConstructL()
{
iSimpleClass = CMySimpleClass :: NewL();
iSimpleClass->AddInt(5);
}
CMyCompoundClass* CMyCompoundClass::NewLC()
{
CMyCompoundClass* self= new (ELeave) CMyCompoundClass;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMyCompoundClass* CMyCompoundClass::NewL()
{
CMyCompoundClass *self = new (ELeave) CMyCompoundClass;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
TInt CMyCompoundClass::Get()
{
return iSimpleClass->Get();
}
void CMyCompoundClass::AddInt()
{
iSimpleClass->AddInt(5);
}
###################################################
#include <e32base.h>
#include "CMySimpleClass.h"
class CMyCompoundClassublic CBase
{
public:
CMyCompoundClass();
~CMyCompoundClass();
void AddInt();
TInt Get();
static CMyCompoundClass* NewL();
static CMyCompoundClass* NewLC();
void ConstructL();
private:
CMySimpleClass *iSimpleClass;
};
/* Copyright (c) 2004, Nokia. All rights reserved */
###################################################
// INCLUDE FILES
#include <coemain.h>
#include "HelloWorldBasicAppView.h"
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewL( const TRect& aRect )
{
CHelloWorldBasicAppView* self = CHelloWorldBasicAppView::NewLC( aRect );
CleanupStack::Pop( self );
return self;
}
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewLC( const TRect& aRect )
{
CHelloWorldBasicAppView* self = new ( ELeave ) CHelloWorldBasicAppView;
CleanupStack::PushL( self );
self->ConstructL( aRect );
return self;
}
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CHelloWorldBasicAppView::ConstructL( const TRect& aRect )
{
// Create a window for this application view
CreateWindowL();
// Set the windows size
SetRect( aRect );
iCompoundClass = CMyCompoundClass :: NewL();
// Activate the window, which makes it ready to be drawn
ActivateL();
}
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView::CHelloWorldBasicAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CHelloWorldBasicAppView::CHelloWorldBasicAppView()
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView::~CHelloWorldBasicAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CHelloWorldBasicAppView::~CHelloWorldBasicAppView()
{
// No implementation required
delete iCompoundClass;
}
// -----------------------------------------------------------------------------
// CHelloWorldBasicAppView:raw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CHelloWorldBasicAppView:raw( const TRect& /*aRect*/ ) const
{
// Get the standard graphics context
CWindowGc& gc = SystemGc();
// Gets the control's extent
TRect rect = Rect();
// to the Draw-method:
// get the number
TInt number=iCompoundClass->Get();
// create a descriptor and copy the number into it
TBuf<32> numAsText;
numAsText.Num(number); // convert the number to the text
// write the text to the display
gc.UseFont(iCoeEnv->NormalFont());
gc.DrawText(numAsText, TPoint(10,40));
gc.DiscardFont();
ResetGc();
// Clears the screen
gc.Clear( rect );
}
// End of File
/* Copyright (c) 2004, Nokia. All rights reserved */
###################################################
#ifndef __HELLOWORLDBASICAPPVIEW_H__
#define __HELLOWORLDBASICAPPVIEW_H__
// INCLUDES
#include <coecntrl.h>
#include "CMyCompoundClass.h"
// CLASS DECLARATION
class CEikLabel;
class CHelloWorldBasicAppView : public CCoeControl
{
public: // New methods
/**
* NewL.
* Two-phased constructor.
* Create a CHelloWorldBasicAppView object, which will draw itself to aRect.
* @param aRect The rectangle this view will be drawn to.
* @return a pointer to the created instance of CHelloWorldBasicAppView.
*/
static CHelloWorldBasicAppView* NewL( const TRect& aRect );
/**
* NewLC.
* Two-phased constructor.
* Create a CHelloWorldBasicAppView object, which will draw itself
* to aRect.
* @param aRect Rectangle this view will be drawn to.
* @return A pointer to the created instance of CHelloWorldBasicAppView.
*/
static CHelloWorldBasicAppView* NewLC( const TRect& aRect );
/**
* ~CHelloWorldBasicAppView
* Virtual Destructor.
*/
virtual ~CHelloWorldBasicAppView();
void ConstructL(const TRect& aRect);
public: // Functions from base classes
/**
* From CCoeControl, Draw
* Draw this CAnimationAppView to the screen.
* @param aRect the rectangle of this view that needs updating
*/
void Draw( const TRect& aRect ) const;
private: // Constructors
/**
* ConstructL
* 2nd phase constructor.
* Perform the second phase construction of a
* CHelloWorldBasicAppView object.
* @param aRect The rectangle this view will be drawn to.
*/
/**
* CHelloWorldBasicAppView.
* C++ default constructor.
*/
CHelloWorldBasicAppView();
// CEikLabel* iLabel; // example label
// CEikLabel* iMyLabel; // added 4.9
// CEikLabel* iToDoLabel; // example label
CMyCompoundClass* iCompoundClass;
};
#endif // __HELLOWORLDBASICAPPVIEW_H__
// End of File
There is all the code, can someone say what am I doing wrong?

ublic CBase
raw()
Reply With Quote


