PDA

View Full Version : Error Including Symbian C++ APIs



amir
4th September 2011, 08:16
Hi there,

Recently, I'm developing a Symbian App using Qt.
There is big problem driving me crazy :

I'm Using Qt 4.7 and I wanna Use Text-to-Speech API of S60.
Here is the code :

ttsplayer.h :


#ifndef __TTSPLAYER_H__
#define __TTSPLAYER_H__

// Include Files
#include <MdaAudioSamplePlayer.h>
#include <e32base.h>

class CTtsPlayer : public CBase, public MMdaAudioPlayerCallback
{
public:
// construction
static CTtsPlayer* NewLC();
~CTtsPlayer();
/** Simplified call'n'forget interface.
* Synchronous function
* @leave System-wide error codes. @see MMdaAudioPlayerCallback errors
*/
void PlayTextL( TDesC& aText );
// From the observer interface
public:
virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration);
virtual void MapcPlayComplete(TInt aError);
private:
void ConstructL();
private:
CMdaAudioPlayerUtility* iPlayer;
TBool iPlaybackInProgress;
CActiveSchedulerWait* iWaiter;
// Playback error code
TInt iErr;
};


#endif // __TTSPLAYER_H__

// End of file


ttsplayer.cpp :


// Include Files

#include <e32base.h>
#include <e32std.h>
#include <e32def.h>
#include "TtsPlayer.h"

// Prefix telling the audio utility that TTS should be used
_LIT( KTtsPrefix, "(tts)" );

CTtsPlayer* CTtsPlayer::NewLC()
{
CTtsPlayer* self = new (ELeave) CTtsPlayer;
CleanupStack::PushL( self );
self->ConstructL();
return self;
}

CTtsPlayer::~CTtsPlayer()
{
delete iWaiter;
delete iPlayer;
}

void CTtsPlayer::ConstructL()
{
iPlayer = CMdaAudioPlayerUtility::NewL( *this );
iWaiter = new (ELeave) CActiveSchedulerWait;
}

void CTtsPlayer::PlayTextL( TDesC& aText )
{
__ASSERT_ALWAYS( iPlaybackInProgress == EFalse, User::Leave( KErrNotReady ) );
HBufC8* playableText = HBufC8::NewLC( aText.Length() + KTtsPrefix().Length() );
playableText->Des().Append( KTtsPrefix );
playableText->Des().Append( aText );
iPlayer->OpenDesL( *playableText );
iPlaybackInProgress = ETrue;
iWaiter->Start();
// At this point playback is already completed or failed
User::LeaveIfError( iErr );
CleanupStack::PopAndDestroy( playableText );
}

void CTtsPlayer::MapcInitComplete( TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/ )
{
iErr = aError;
if( aError != KErrNone )
{
iPlaybackInProgress = EFalse;
// Let the paused PlayTextL complete
iWaiter->AsyncStop();
}
else
{
iPlayer->Play();
}
}

void CTtsPlayer::MapcPlayComplete( TInt aError )
{
iErr = aError;
iPlaybackInProgress = EFalse;
// Let the paused PlayTextL complete
iWaiter->AsyncStop();
}
// End of file


and in the mainwindow.cpp I use this like this :


CTtsPlayer* player = CTtsPlayer::NewLC();
_LIT( KTextToSay, "All your voices are belong to us!" );
TBuf<100> bTextToSay( KTextToSay );

TRAPD( err, player->PlayTextL( bTextToSay ) );
if( err != KErrNone )
{
qDebug() << QString("TTS playback failed with [%1]").arg(err);
}
else
{
qDebug() << "TTS playback completed successfully" ;
}
CleanupStack::PopAndDestroy( player );


and I also added these files(ttsplayer.cpp,ttsplayer.h) to symbian in .pro file.
But Now my problem is errors below :
:-1: error: Recipe compile failed with exit code 1.
:-1: error: The make-engine exited with errors.

Please Help.
Thanks in advance.

mvuori
4th September 2011, 08:30
I really have no idea. But if those are errors reported in the "Build issues" tab, you may have some detailed and important information in the "Compile Output" tab, which might actually tell you what the problem is and where it is.

amir
4th September 2011, 08:47
Here is the compile output :

Sorry but My Project name is private and I used "(MyPrivateProjectName)" instead.

Running build steps for project (MyPrivateProjectName)...
Configuration unchanged, skipping qmake step.
Starting: "D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\m ake.exe" release-gcce -w
D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\m ake.exe: Entering directory `D:/QtProj/(MyPrivateProjectName)'
sbs -c arm.v5.urel.gcce4_4_1
target : epoc32\release\armv5\urel\(MyPrivateProjectName).e xe [arm.v5.urel.gcce4_4_1]
d:/qtsdk/symbian/tools/gcce4/bin/../lib/gcc/arm-none-symbianelf/4.4.1/../../../../arm-none-symbianelf/bin/ld.exe: warning: D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/release/armv5/urel/usrt3_1.lib(ucppinit.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/build/(MyPrivateProjectName)/c_e6b93d046398cd60/(MyPrivateProjectName)_exe/armv5/urel/ttsplayer.o: In function `CTtsPlayer::PlayTextL(TDesC16&)':
D:/QtProj/(MyPrivateProjectName)/ttsplayer.cpp:50: undefined reference to `CMdaAudioPlayerUtility::OpenDesL(TDesC8 const&)'
D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/build/(MyPrivateProjectName)/c_e6b93d046398cd60/(MyPrivateProjectName)_exe/armv5/urel/ttsplayer.o: In function `CTtsPlayer::ConstructL()':
D:/QtProj/(MyPrivateProjectName)/ttsplayer.cpp:40: undefined reference to `CMdaAudioPlayerUtility::NewL(MMdaAudioPlayerCallb ack&, int, int)'
collect2: ld returned 1 exit status


sbs : warnings: 0
sbs : errors: 2

built 'arm.v5.urel.gcce4_4_1'

Run time 3 seconds

sbs: build log in D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\build\M akefile.2011-09-04-12-12-08.24-7004.log

FAILED linkandpostlink for arm.v5.urel.gcce4_4_1: epoc32\release\armv5\urel\(MyPrivateProjectName).e xe
mmp: (MyPrivateProjectName)_exe.mmp
mingw32-make[1]: *** [D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/release/armv5/urel/(MyPrivateProjectName).exe] Error 1
sbs: error: The make-engine exited with errors.
D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\m ake.exe: Leaving directory `D:/QtProj/(MyPrivateProjectName)'
D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\m ake.exe: *** [release-gcce] Error 1
The process "D:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\m ake.exe" exited with code 2.
Error while building project (MyPrivateProjectName) (target: Symbian Device)
When executing build step 'Make'

Thanks a lot for answering me.

amir
5th September 2011, 10:42
Can anyone tell me what should I do?

Thanks.

gareth
25th September 2011, 17:12
You need to link against the library which provides the missing symbols - add the following to your .pro file:


LIBS += -lmediaclientaudio
The CMdaAudioPlayerUtility page in the developer library (http://library.developer.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/sdk/doc_source/reference/reference-cpp/Multimedia_Framework/CMdaAudioPlayerUtilityClass.html) tells you which library to link against.

sudhir_ttl
8th December 2011, 10:54
Hi,

I am developing an TTS app on Qt-SDK 1.1.3, I am using the TTS utility developed by Artem Marchenko for this.
The sources are same as which Amir has pasted here.

Now, I am facing a linking problem. I followed the suggestions above but still it didn't help.

I have added the mediaclientaudio library in the .pri file, but still getting the linking errors:


/QtSDK/Symbian/SDKs/Symbian1Qt473/EPOC32/BUILD/QtProjects/myappilcationname_EXE/GCCE/UREL/TtsPlayer.o: In function `CTtsPlayer::ConstructL()':
ttsplayer.cpp:(.text+0xf6): undefined reference to `CMdaAudioPlayerUtility::NewL(MMdaAudioPlayerCallb ack&, int, TMdaPriorityPreference)'
/QtSDK/Symbian/SDKs/Symbian1Qt473/EPOC32/BUILD/QtProjects/myappilcationname_EXE/GCCE/UREL/TtsPlayer.o: In function `CTtsPlayer::PlayTextL(TDesC16&)':
ttsplayer.cpp:(.text+0x160): undefined reference to `CMdaAudioPlayerUtility::OpenDesL(TDesC8 const&)'
make[2]: *** [\QtSDK\Symbian\SDKs\Symbian1Qt473\epoc32\release\g cce\urel\myappilcationname.exe] Error 1
make[1]: *** [TARGETFLASHCARDS_EXE] Error 2


In my application.pri file, i have added
LIBS += -lcone -leikcore -lavkon -lmediaclientaudio

Can anyone suggest me how to resolve this issue? I am stuck at this point.

Thanks,
Sudhir

Added after 30 minutes:

Another update, If I select the build variant as Symbian3, then i am getting an strange error as below:


Recipe compile failed with exit code 1.
The make-engine exited with errors.

This is the same which Amir got...

Can anyone help me to get out this issue please?

Added after 51 minutes:

Hi,

I opened the MdaAudioSamplePlayer.h from the Qt-Creator to found that there are some errors in that file.

I am attaching the screenshot here, you can see that there is an
Unexpected token * popup note when i focus on the error lines.

7162

Please help,

Thanks