what is wrong with this code :?
| Mon, 2007-12-31 04:37 | |
|
hello, can any one advice me what is wrong with the attached code (I zip them all together) I am trying to draw a background image for several days and I have the following errors: Undefined symbol: 'CFbsBitmap::(void) (??0CFbsBitmap@@QAE@XZ)'[] it is build on carbide 1.2 , 2nd edition FP3 I get similar problems when I re-do it for 3rd edition rgds, |
|






Forum posts: 95
Hi,
Link your module against "fbscli.lib".
Add line "LIBRARY fbscli.lib " in the project mmp file.
Chao,
Raghav
Forum posts: 30
hi,
tanks
it is error free now...
but it fails when I try to run it with "Program closed:..."message.
Forum posts: 95
Hi,
What error you are getting. Which thread is panicking.
With the information you provided it is hard to tell what you are doing wrong. If you post the complete error message and some relevant part of your code it will be much easier to point the problem.
Chao,
Raghav
Forum posts: 30
I make most changes in Horoscope2edContainer.cpp and Horoscope2edAppUi.cpp. the following code is this two files. now my program builds with out an error but when I run it, it faills with out any error message.
//CFbsBitmap // iEikonEnv
Name : Horoscope2edContainer.cpp
// INCLUDE FILES
#include "Horoscope2edContainer.h"
//***************************************************
// System includes
#include
#include
#include
// User include // resource file use // Bitmap enumeration
#include
#include
// CONSTANTS
_LIT(KDrawBitmapPath, "\\system\\apps\\Bitmap\\Bitmap.mbm");
const TInt KTopLeftX = 10;
const TInt KTopLeftY = 40;
const TInt KSizeWidth = 400; //154; //400
const TInt KSizeHeight = 390; //90; //390
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#include // for example label control
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CHoroscope2edContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
//*******************************************************
CHoroscope2edContainer* CHoroscope2edContainer::NewL(const TRect& aRect)
{
CHoroscope2edContainer* self = CHoroscope2edContainer::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
CHoroscope2edContainer* CHoroscope2edContainer::NewLC(const TRect& aRect)
{
CHoroscope2edContainer* self = new (ELeave) CHoroscope2edContainer;
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
void CHoroscope2edContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
/*
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( _L("Example View") );
iToDoLabel = new (ELeave) CEikLabel;
iToDoLabel->SetContainerWindowL( *this );
iToDoLabel->SetTextL( _L("Add Your controls\n here") );
*/
//iBitmap = new (ELeave) CFbsBitmap();
//User::LeaveIfError(iBitmap->Load(KDrawBitmapPath, EMbmBitmapDrawbitmap));
SetRect(aRect);
//*******************************************************
TFileName bitmapFile (KDrawBitmapPath);
User::LeaveIfError (CompleteWithAppPath (bitmapFile));
iBitmap = new (ELeave) CFbsBitmap();
User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapZod));
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ActivateL();
}
// Destructor
CHoroscope2edContainer::~CHoroscope2edContainer()
{
//delete iLabel;
//delete iToDoLabel;
delete iBitmap;
}
// ---------------------------------------------------------
// CHoroscope2edContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CHoroscope2edContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
//iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
//iToDoLabel->SetExtent( TPoint(10,100), iToDoLabel->MinimumSize() );
}
// ---------------------------------------------------------
// CHoroscope2edContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CHoroscope2edContainer::CountComponentControls() const
{
return 2; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CHoroscope2edContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
/*CCoeControl* CHoroscope2edContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
//case 0:
// return iBitmap;
case 1:
return iToDoLabel;
default:
return NULL;
}
}*/
// ---------------------------------------------------------
// CHoroscope2edContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CHoroscope2edContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...^
//*************************************'
gc.Clear(aRect);
TPoint topLeft(KTopLeftX, KTopLeftY);
TSize bitmapSize(KSizeWidth, KSizeHeight);
gc.DrawBitmap(TRect(topLeft, bitmapSize), iBitmap);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//gc.SetPenStyle( CGraphicsContext::ENullPen );
//gc.SetBrushColor( KRgbGray );
//gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
}
// ---------------------------------------------------------
// CHoroscope2edContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CHoroscope2edContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
Name : CHoroscope2edAppUi.cpp
// INCLUDE FILES
#include "Horoscope2edApp.h"
#include "Horoscope2edAppui.h"
#include "Horoscope2edContainer.h"
#include
#include "Horoscope2ed.hrh"
#include "Horoscope2ed.hlp.hrh"
#include
#include
#include
#include
// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CHoroscope2edAppUi::ConstructL()
//
// ----------------------------------------------------------
//
void CHoroscope2edAppUi::ConstructL()
{
BaseConstructL();
iAppContainer = new (ELeave) CHoroscope2edContainer;
iAppContainer->SetMopParent( this );
iAppContainer->ConstructL( ClientRect() );
AddToStackL( iAppContainer );
}
// ----------------------------------------------------
// CHoroscope2edAppUi::~CHoroscope2edAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CHoroscope2edAppUi::~CHoroscope2edAppUi()
{
if (iAppContainer)
{
RemoveFromStack( iAppContainer );
delete iAppContainer;
}
}
// ------------------------------------------------------------------------------
// CHoroscope2edAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
// This function is called by the EIKON framework just before it displays
// a menu pane. Its default implementation is empty, and by overriding it,
// the application can set the state of menu items dynamically according
// to the state of application data.
// ------------------------------------------------------------------------------
//
void CHoroscope2edAppUi::DynInitMenuPaneL(
TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
{
}
// ----------------------------------------------------
// CHoroscope2edAppUi::HandleKeyEventL(
// const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CHoroscope2edAppUi::HandleKeyEventL(
const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
{
return EKeyWasNotConsumed;
}
// ----------------------------------------------------* buf = CCoeAppUi::AppHelpContextL();
// CHoroscope2edAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CHoroscope2edAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAknSoftkeyExit:
case EEikCmdExit:
{
Exit();
break;
}
case EHoroscope2edCmdAppTest:
{
// Load localized message from the resource file
HBufC* message = CEikonEnv::Static()->AllocReadResourceLC(R_MESSAGE_TEXT);
// Show information note dialog
CAknInformationNote* note = new (ELeave) CAknInformationNote;
note->ExecuteLD(message->Des());
CleanupStack::PopAndDestroy(message);
break;
}
case EHoroscope2edCmdHelp:
{
CArrayFix
HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
break;
}
case EHoroscope2edCmdAbout:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA1:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_ARIES_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ARIES_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA2:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_TAURUS_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_TAURUS_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA3:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_GEMINI_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_GEMINI_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA4:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_CANCER_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_CANCER_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA5:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_LEO_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_LEO_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA6:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_VIRGO_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_VIRGO_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA7:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_LIBRA_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_LIBRA_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA8:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_SCORPIO_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_SCORPIO_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA9:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_SAGITTARIUS_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_SAGITTARIUS_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA10:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_CAPRICORN_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_CAPRICORN_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA11:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_AQUARIUS_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_AQUARIUS_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
case ECommandA12:
{
CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
HBufC* title = iEikonEnv->AllocReadResourceLC(R_PISCES_DIALOG_TITLE);
dlg->QueryHeading()->SetTextL(*title);
CleanupStack::PopAndDestroy(); //title
HBufC* msg = iEikonEnv->AllocReadResourceLC(R_PISCES_DIALOG_TEXT);
dlg->SetMessageTextL(*msg);
CleanupStack::PopAndDestroy(); //msg
dlg->RunLD();
break;
}
// TODO: Add Your command handling code here
default:
break;
}
}
CArrayFix* CHoroscope2edAppUi::HelpContextL() const* array = new(ELeave)CArrayFixFlat(1);
{
CArrayFixFlat
CleanupStack::PushL(array);
array->AppendL(TCoeHelpContext(KUidHoroscope2ed, KGeneral_Information));
CleanupStack::Pop(array);
return array;
}
Forum posts: 1058
I would say: Debug it. If you don't know yet how to debug, learn it now. You will badly need it.
René Brunner
Forum posts: 65
Hai symbianProgramer,
I think u r not capturing the Error.It is better to capture the ErrorCode.Pls follow the following procedure to capture the error code.
Create a Folder and name the folder as "ErrRd " in the following path "C:\Symbian\8.1a\S60_2nd_FP3\Epoc32\winscw\c\system\Bootdata\".
In ur System in which drive have u installed ur Symbian SDk,if it is "D" drive then change the path.After capturing the Errorcode then search for that error in SDK help or go for Google search.I think this may help u.
Forum posts: 30
hi
the Errorcode is System Error (-1)
am on searching for it now.
Forum posts: 132
-1 is KErrNotFound. Step through your code in the debugger to find out at which point it fails which should tell you what it is that it cannot find.
Forum posts: 30
Forum posts: 132
Why can't you figure out the problem debugging?
-1 means KErrNotFound, so either something can't be found at program start up or something can't be found during program execution.
If you can't get as far as lauching your program then it is probably something like a .dll or .lib that is missing and that can't be found, if that is the case then check all your dlls etc. are present in the correct locations.
If you can load your app then you can step through it in the debugger line by line until something happens that you weren't expecting. As you are reading resources and the error is -1 then personally I would put a breakpoint on the lines that are reading thoese resources to check that the resources are not missing.
Forum posts: 65
Hai SymbianProgrammer,
what is ur appliaction?r u adding Bitmap to ur Application?Have u added the Bitmap to ur application and also have u added in .mmp File?
Forum posts: 30
yes I have added the bit map and update the .mmp file included the .rsg and .mbg files etc..
rgds
nex
Forum posts: 30
hello every body
as I have debug my project which I put the main parts on the top of this page. I have figured out where the system error (-1) comes form.
It is when it wantes to run the ActivateL(); in the ConstructL (which is the following method below)
can any one help me why it happned and how I am going to fix it?
void CHoroscope2edContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
//*******************************************************
TFileName bitmapFile (KDrawBitmapPath);
User::LeaveIfError (CompleteWithAppPath (bitmapFile));
iBitmap = new (ELeave) CFbsBitmap();
User::LeaveIfError(iBitmap->Load(bitmapFile, EMbmBitmapZod));
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ActivateL();
}
rgds,
nex
Forum posts: 5
After the line with "CompleteWithAppPath", try RDebug::Print(_L("CHoroscope2edContainer::ConstructL %S"), bitmapFile), and check that it's actually the right file.
If the file exists, you may also want to check that EMbmBitmapZod is in the file. This is more difficult.
Forum posts: 132
If You already know -1 means KErrNotFound so don't you think it is a logical next step to check the contents of the bitmap variable, its path and file name, and then check the file actually exists in the location specified.