Using Phonon in Qt5 - a simple video player

1.4k views Asked by At

So what I'm trying to do is stream an ip camera using phonon (vlc backend) in qt5.

I know phonon needs some changes in order to work in qt5 and I've made them, the libraries which used weren't writable, I made them writable, edited them but I'm still getting lots of errors. Then I assumed there might be something wrong with phonon! so I downloaded phonon for qt 5. but the result was the same.

even creating an object gives me errors, after Googling my error, I found out there is linking problem but I don't know how to fix it.

.pro file:

   Qt       += phonon4qt5    

header file:

    #include <phonon4qt5/phonon/VideoPlayer>
.
.
.
    Phonon::VideoPlayer *videoPlayer;

cpp file:

videoPlayer=new Phonon::VideoPlayer(Phonon::VideoCategory,this);

I get these errors:

/home/user/Projects/VideoPlayer-Phonon2/mainwindow.cpp:9: error: undefined reference to `Phonon::VideoPlayer::VideoPlayer(Phonon::Category, QWidget*)'
:-1: error: collect2: error: ld returned 1 exit status
1

There are 1 answers

1
MBach On
  1. Why are you struggling with Phonon? It's no longer supported in Qt5!
  2. Anyway, undefined references means that you need to link the library explicitly. You have included with Qt += phonon4qt5, now you have to provide LIBS += -L/path/to/phonon -lphonon4qt5