Phonon inkludieren scheitert

Alles rund um die Programmierung mit Qt
Antworten
Flasher
Beiträge: 5
Registriert: 25. Oktober 2007 00:36

Phonon inkludieren scheitert

Beitrag von Flasher »

Hallo!

Ich bin noch relativ neu in QT, habe bisher nur ein Projekt mit QT Jambi gemacht, aber noch kein C++ Qt programmiert.

Ich verwende unter Linux Eclipse + QT Integration und habe QT 4.4 + Phonon installiert. (Verwende KDE 4 mit ein paar auf Phonon basierenden Applikationen wie z.b. Amarok 2) Dies nur vorab um zu zeigen, dass ich auch wirklich alles notwendige installiert habe :wink:

Ich möchte eine kleine Phonon-Testanwendung schreiben um später phonon in ein anderes Projekt integrieren zu können.

Dazu habe ich im pro-File phonon hinzugefügt:

Code: Alles auswählen

TEMPLATE = app
TARGET = consoleradio
QT += core \
    gui \
    phonon
HEADERS += 
SOURCES += main.cpp
FORMS += 
RESOURCES += 
und qmake ausgeführt.

In der main.cpp befindet sich folgender source-code:

Code: Alles auswählen

#include <QtGui>
#include <phonon>


int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    Phonon::MediaObject *music =
        Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource("/path/mysong.wav"));
    music->play();

    return app.exec();
}
Ich habe mich nach der Anleitung von Trolltech gerichtet:
http://doc.trolltech.com/4.4/phonon-module.html

Beim Kompilieren scheitert es allerdings immer daran, dass er phonon nicht findet:
make debug
make -f Makefile.Debug
make[1]: Entering directory `/home/andreas/workspace/consoleradio'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/phonon -I/usr/include/phonon -I/usr/include -Idebug -I. -o debug/main.o main.cpp
main.cpp:2:18: error: phonon: No such file or directory
Das kann aber eigentlich nicht sein, weil unter /usr/include/phonon alles vorhanden ist! Ein ls -l:
-rw-r--r-- 1 root root 1919 2008-11-19 23:20 abstractaudiooutput.h
-rw-r--r-- 1 root root 6633 2008-11-19 23:20 abstractmediastream.h
-rw-r--r-- 1 root root 2301 2008-11-19 23:20 abstractvideooutput.h
-rw-r--r-- 1 root root 2992 2008-11-19 23:20 addoninterface.h
-rw-r--r-- 1 root root 6853 2008-11-19 23:20 audiooutput.h
-rw-r--r-- 1 root root 4415 2008-11-19 23:42 audiooutputinterface.h
-rw-r--r-- 1 root root 7119 2008-11-19 23:20 backendcapabilities.h
-rw-r--r-- 1 root root 9733 2008-11-19 23:20 backendinterface.h
-rw-r--r-- 1 root root 3758 2008-11-19 23:20 effect.h
-rw-r--r-- 1 root root 2324 2008-11-19 23:20 effectinterface.h
-rw-r--r-- 1 root root 7644 2008-11-19 23:20 effectparameter.h
-rw-r--r-- 1 root root 2522 2008-11-19 23:20 effectwidget.h
drwxr-xr-x 2 root root 4096 2008-11-27 07:51 experimental/
-rw-r--r-- 1 root root 5800 2008-11-19 23:20 mediacontroller.h
-rw-r--r-- 1 root root 2211 2008-11-19 23:20 medianode.h
-rw-r--r-- 1 root root 23104 2008-11-20 13:13 mediaobject.h
-rw-r--r-- 1 root root 8949 2008-11-19 23:20 mediaobjectinterface.h
-rw-r--r-- 1 root root 8523 2008-11-19 23:20 mediasource.h
-rw-r--r-- 1 root root 11657 2008-11-19 23:20 objectdescription.h
-rw-r--r-- 1 root root 16761 2008-11-19 23:20 objectdescriptionmodel.h
-rw-r--r-- 1 root root 7858 2008-11-19 23:20 path.h
-rw-r--r-- 1 root root 1802 2008-11-19 23:20 phonon_export.h
-rw-r--r-- 1 root root 3887 2008-11-19 23:20 phonondefs.h
-rw-r--r-- 1 root root 8841 2008-11-27 07:50 phononnamespace.h
-rw-r--r-- 1 root root 3800 2008-11-19 23:20 platformplugin.h
-rw-r--r-- 1 root root 4883 2008-11-19 23:20 seekslider.h
-rw-r--r-- 1 root root 4514 2008-11-19 23:20 streaminterface.h
-rw-r--r-- 1 root root 6258 2008-11-20 13:06 videoplayer.h
-rw-r--r-- 1 root root 7631 2008-11-19 23:20 videowidget.h
-rw-r--r-- 1 root root 2382 2008-11-19 23:20 videowidgetinterface.h
-rw-r--r-- 1 root root 6326 2008-11-19 23:20 volumefadereffect.h
-rw-r--r-- 1 root root 1976 2008-11-19 23:20 volumefaderinterface.h
-rw-r--r-- 1 root root 4992 2008-11-19 23:20 volumeslider.h
Auch die Libs selber sind im System vorhanden. Ein ls -l /usr/lib/libph*
lrwxrwxrwx 1 root root 14 2008-11-27 07:51 libphonon.so -> libphonon.so.4*
lrwxrwxrwx 1 root root 18 2008-11-27 07:51 libphonon.so.4 -> libphonon.so.4.2.1*
-rwxr-xr-x 1 root root 320030 2008-11-27 07:51 libphonon.so.4.2.1*
lrwxrwxrwx 1 root root 26 2008-11-27 07:51 libphononexperimental.so -> libphononexperimental.so.4*
lrwxrwxrwx 1 root root 30 2008-11-27 07:51 libphononexperimental.so.4 -> libphononexperimental.so.4.2.1*
-rwxr-xr-x 1 root root 64592 2008-11-27 07:51 libphononexperimental.so.4.2.1*
Habe ich irgendetwas übersehen? Bin mittlerweile etwas ratlos :?

Danke für eure Hilfe!

Schöne Grüße,

Flasher
Ginsengelf
Beiträge: 79
Registriert: 2. Mai 2007 10:21

Beitrag von Ginsengelf »

Moin, hast du mal versucht, die Dateien einzeln zu inkludieren? Also statt

Code: Alles auswählen

#include <phonon> 
mal

Code: Alles auswählen

#include <phonon/mediaobject.h> 
und so weiter versucht?

Ginsengelf
franzf
Beiträge: 3114
Registriert: 31. Mai 2006 11:15

Beitrag von franzf »

Bei mir liegen die qt-header in /usr/include/qt4/.
Da gibt es für jedes Modul (QtGui/QtCore/phonon/...) ein verzeichnis mit allen Headern.
Außerdem gibt es ein Verzeichnis "Qt", in dem alle Qt-Header liegen, aber auch die Header, die alles aus einem Modul includieren.
Hast du in diesem "Qt"-Verzeichnis auch eine Datei namens "phonon"?
Flasher
Beiträge: 5
Registriert: 25. Oktober 2007 00:36

Beitrag von Flasher »

Hallo!

Hier scheint der Hund begraben zu sein:

Ich kann alle header-files einzeln inkludieren:

Code: Alles auswählen

#include "abstractaudiooutput.h"
#include "abstractmediastream.h"
#include "abstractvideooutput.h"
#include "addoninterface.h"
#include "audiooutput.h"
#include "audiooutputinterface.h"
#include "backendcapabilities.h"
#include "backendinterface.h"
#include "effect.h"
#include "effectinterface.h"
#include "effectparameter.h"
#include "effectwidget.h"
#include "mediacontroller.h"
#include "medianode.h"
#include "mediaobject.h"
#include "mediaobjectinterface.h"
#include "mediasource.h"
#include "objectdescription.h"
#include "objectdescriptionmodel.h"
#include "path.h"
#include "phonondefs.h"
#include "phononnamespace.h"
#include "seekslider.h"
#include "streaminterface.h"
#include "videoplayer.h"
#include "videowidget.h"
#include "videowidgetinterface.h"
#include "volumefadereffect.h"
#include "volumefaderinterface.h"
#include "volumeslider.h"
dann funktioniert es.

Allerdings befindet sich im Ordner /usr/include/Qt neben den "Sammel-Include-Header-Files":
-rw-r--r-- 1 root root 2770 2008-09-27 11:00 Qt3Support
-rw-r--r-- 1 root root 2911 2008-09-27 11:00 QtCore
-rw-r--r-- 1 root root 446 2008-09-27 11:00 QtDBus
-rw-r--r-- 1 root root 5271 2008-09-27 11:00 QtGui
-rw-r--r-- 1 root root 297 2008-09-27 11:00 QtHelp
-rw-r--r-- 1 root root 661 2008-09-27 11:00 QtNetwork
-rw-r--r-- 1 root root 152 2008-09-27 11:00 QtOpenGL
-rw-r--r-- 1 root root 399 2008-09-27 11:00 QtScript
-rw-r--r-- 1 root root 393 2008-09-27 11:00 QtSql
-rw-r--r-- 1 root root 155 2008-09-27 11:00 QtSvg
-rw-r--r-- 1 root root 192 2008-09-27 11:00 QtTest
-rw-r--r-- 1 root root 241 2008-09-27 11:00 QtWebKit
-rw-r--r-- 1 root root 85 2008-09-27 11:00 QtXml
KEINE Datei mit dem Namen "phonon". Ich habe das ganze System nach einer Datei "phonon" abgesucht und nicht gefunden. Anscheinend hat der QT-Maintainer den Phonon Support in QT nicht sauber ins Package integriert.


Schöne Grüße,

Flasher
franzf
Beiträge: 3114
Registriert: 31. Mai 2006 11:15

Beitrag von franzf »

Flasher hat geschrieben:
-rw-r--r-- 1 root root 2770 2008-09-27 11:00 Qt3Support
-rw-r--r-- 1 root root 2911 2008-09-27 11:00 QtCore
-rw-r--r-- 1 root root 446 2008-09-27 11:00 QtDBus
-rw-r--r-- 1 root root 5271 2008-09-27 11:00 QtGui
-rw-r--r-- 1 root root 297 2008-09-27 11:00 QtHelp
-rw-r--r-- 1 root root 661 2008-09-27 11:00 QtNetwork
-rw-r--r-- 1 root root 152 2008-09-27 11:00 QtOpenGL
-rw-r--r-- 1 root root 399 2008-09-27 11:00 QtScript
-rw-r--r-- 1 root root 393 2008-09-27 11:00 QtSql
-rw-r--r-- 1 root root 155 2008-09-27 11:00 QtSvg
-rw-r--r-- 1 root root 192 2008-09-27 11:00 QtTest
-rw-r--r-- 1 root root 241 2008-09-27 11:00 QtWebKit
-rw-r--r-- 1 root root 85 2008-09-27 11:00 QtXml
KEINE Datei mit dem Namen "phonon". Ich habe das ganze System nach einer Datei "phonon" abgesucht und nicht gefunden. Anscheinend hat der QT-Maintainer den Phonon Support in QT nicht sauber ins Package integriert.
Ok. Ist sicherlich nen Bug-report wert ;)
Für dich als (temporärer) fix:
Such dir das Verzeichnis, in dem du alle Modul-VERZEICHNISSE mit den ganzen Modul-headern hast (QtGui, QtCore, phonon).
Wechsel ins dortige phonon-Verzeichnis.
Da mach dann ein

Code: Alles auswählen

for i in *; do echo "#include "${i}"" >> /usr/include/Qt/phonon; done
Bei einem diff fällt mir allerdings gerade auf, dass 2 Header im phonon-Verzeichnis liegen die bei mir (Gentoo) nicht im Modul-Header "phonon" auftauchen:
- phonon_export.h
- phonon
evtl. willst du aus dem eben generierten File diese beiden Zeilen noch löschen.

Grüße
Franz
Flasher
Beiträge: 5
Registriert: 25. Oktober 2007 00:36

Beitrag von Flasher »

Vielen Dank!

Ich verwende Arch Linux und habe mal kurz das Paket selbst erstellen lassen.

Der Maintainer hat Qt aufgesplittet, sprich Qt ohne phonon support und dafür ein extra phonon Package! Hier scheint der Bug entstanden zu sein. Wenn ich das Qt mit phonon support kompilieren lasse, gibt es auch das phonon-header-file.

Schöne Grüße,

Flasher
Antworten