简体   繁体   中英

Using Phonon in Qt5 - a simple video player

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM