PDA

View Full Version : problem in qt (phonon)



Praveen30
April 19th, 2011, 01:03 PM
Hello everyone,

I have taken a class in #ubuntu-classroom.here is the link--
http://irclogs.ubuntu.com/2011/04/15/%23ubuntu-classroom.html

In this class apachelogger told us how to run an application using phonon...it was quite good.Now i am having some problem in running my first application using phonon...




#include <QtGui/QApplication>

#include <Phonon/AudioOutput>
#include <Phonon/MediaObject>
#include <Phonon/MediaSource>
#include <Phonon/VideoWidget>
#include <Phonon/VideoPlayer>

using namespace Phonon;

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MediaObject mo;
AudioOutput ao;
createPath(&mo,&ao);
mo.setCurrentSource(MediaSource("./first_run_jingle.ogg"));
mo.play();
return a.exec();
}
when i run this application using qmake -project, qmake and make..i am getting bunch of errors..



praveen@ubuntu:~/phonon-template$ qmake -project
praveen@ubuntu:~/phonon-template$ qmake
praveen@ubuntu:~/phonon-template$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp:3:30: error: Phonon/AudioOutput: No such file or directory
main.cpp:4:30: error: Phonon/MediaObject: No such file or directory
main.cpp:5:30: error: Phonon/MediaSource: No such file or directory
main.cpp:6:30: error: Phonon/VideoWidget: No such file or directory
main.cpp:7:30: error: Phonon/VideoPlayer: No such file or directory
main.cpp:9: error: ‘Phonon’ is not a namespace-name
main.cpp:9: error: expected namespace-name before ‘;’ token
main.cpp: In function ‘int main(int, char**)’:
main.cpp:14: error: ‘MediaObject’ was not declared in this scope
main.cpp:14: error: expected ‘;’ before ‘mo’
main.cpp:15: error: ‘AudioOutput’ was not declared in this scope
main.cpp:15: error: expected ‘;’ before ‘ao’
main.cpp:16: error: ‘mo’ was not declared in this scope
main.cpp:16: error: ‘ao’ was not declared in this scope
main.cpp:16: error: ‘createPath’ was not declared in this scope
main.cpp:17: error: ‘MediaSource’ was not declared in this scope
make: *** [main.o] Error 1
guys please suggest me something.....

Ƨuperhero
April 19th, 2011, 06:04 PM
Did you add the following line to your .pro file?

QT += phonon

Praveen30
April 19th, 2011, 06:27 PM
Did you add the following line to your .pro file?

QT += phonon

yes i have checked this,,but it is of no avail....

Ƨuperhero
April 19th, 2011, 06:40 PM
Are you sure you installed libphonon-dev?

benson444
April 19th, 2011, 06:56 PM
I think the #includes should be <phonon/...> instead of <Phonon/...>

After changing them, and adding the phonon module to the .pro file, it compiled for me.