Seite 1 von 1

Problem mit Phonon (undefined reference)

Verfasst: 14. März 2010 13:29
von Adrian
Hallo,
ich experimentiere gerade ein wenig mit Phonon, als Test will ich einfach eine Datei abspielen. Aber schon das Erzeugen der nötigen MediaObjects und des AudioOutputs scheitert an einem Linker-Error.

Code: Alles auswählen

audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mediaObject = new Phonon::MediaObject(this);
metaInformationResolver = new Phonon::MediaObject(this);
Phonon::createPath(mediaObject, audioOutput);
Definition:

Code: Alles auswählen

private:
    Phonon::MediaObject *mediaObject;
    Phonon::MediaObject *metaInformationResolver;
    Phonon::AudioOutput *audioOutput;
    QList<Phonon::MediaSource> sources;
Eingebundene Phonon-Header:

Code: Alles auswählen

#include <Phonon/AudioOutput>
#include <Phonon/MediaObject>
#include <Phonon/BackendCapabilities>
Das kompilieren funktioniert in KDevelop4 einwandfrei, jedoch gibt es folgende Fehler beim Linken:
Linking CXX executable Musikspieler
CMakeFiles/Musikspieler.dir/Musikspieler_automoc.o: In function `QList<Phonon::MediaSource>::~QList()':
Musikspieler_automoc.cpp:(.text._ZN5QListIN6Phonon11MediaSourceEED1Ev[QList<Phonon::MediaSource>::~QList()]+0x45): undefined reference to `Phonon::MediaSource::~MediaSource()'
CMakeFiles/Musikspieler.dir/mainwindow.o: In function `MainWindow::setupPhonon()':
mainwindow.cpp:(.text+0x29): undefined reference to `Phonon::AudioOutput::AudioOutput(Phonon::Category, QObject*)'
mainwindow.cpp:(.text+0x46): undefined reference to `Phonon::MediaObject::MediaObject(QObject*)'
mainwindow.cpp:(.text+0x63): undefined reference to `Phonon::MediaObject::MediaObject(QObject*)'
mainwindow.cpp:(.text+0x79): undefined reference to `Phonon::MediaObject::setTickInterval(int)'
mainwindow.cpp:(.text+0xaa): undefined reference to `Phonon::createPath(Phonon::MediaNode*, Phonon::MediaNode*)'
mainwindow.cpp:(.text+0xb5): undefined reference to `Phonon::Path::~Path()'
CMakeFiles/Musikspieler.dir/mainwindow.o: In function `MainWindow::addFiles()':
mainwindow.cpp:(.text+0x21f): undefined reference to `Phonon::MediaSource::MediaSource(QString const&)'
mainwindow.cpp:(.text+0x259): undefined reference to `Phonon::MediaSource::MediaSource(Phonon::MediaSource const&)'
mainwindow.cpp:(.text+0x266): undefined reference to `Phonon::MediaSource::~MediaSource()'
mainwindow.cpp:(.text+0x2db): undefined reference to `Phonon::MediaObject::setCurrentSource(Phonon::MediaSource const&)'
CMakeFiles/Musikspieler.dir/mainwindow.o: In function `QList<Phonon::MediaSource>::detach_helper()':
mainwindow.cpp:(.text._ZN5QListIN6Phonon11MediaSourceEE13detach_helperEv[QList<Phonon::MediaSource>::detach_helper()]+0x64): undefined reference to `Phonon::MediaSource::MediaSource(Phonon::MediaSource const&)'
mainwindow.cpp:(.text._ZN5QListIN6Phonon11MediaSourceEE13detach_helperEv[QList<Phonon::MediaSource>::detach_helper()]+0xa5): undefined reference to `Phonon::MediaSource::~MediaSource()'
Muss ich noch etwas speziell für Phonon in die CMakeLists.txt schreiben o.ä.? Oder in KDevelop etwas konfigurieren? Danke schonmal.

Verfasst: 14. März 2010 13:36
von Christian81
Wie wäre es mit gegen die Phonon-libs linken?

Verfasst: 14. März 2010 13:43
von Adrian
Ja, doch wie? Kann ich das direkt in KDevelop machen oder muss ich die CMakeLists.txt bearbeiten? (Komisch ist auch, dass KDevelop selbst die Header findet, der Kompiler aber nicht)
@Edit: Hat sich erledigt, ich musste nur noch ein ${KDE4_PHONON_LIBS} zu den traget_link_libaries hinzufügen.