Qt World Summit: Submit your Presentation

[SOLVED] Netbeans 7.3.1 & Phonon

  • Hi,

    I'm trying to compile the following code :
    @QUrl urlVideo = QString("C:\Users\Doe\Desktop\Aaaah.mp4");
    Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory, 0);

    But i got this error :

    bq. c:/Qt/4.8.4/lib/libqtmaind.a(qtmain_win.o): In function WinMain@16': c:\iwmake\build_mingw_opensource\src\winmain/qtmain_win.cpp:131: undefined reference toqMain(int, char**)'

    Do you know how to fix this ?


  • Lifetime Qt Champion


    Is it the complete code ? Or do you have it in a main.cpp ?

  • No this is not the complete code : before adding this in my current project I do some test in a separate test project.
    Here is the main :

    @#include <QtGui/QApplication>
    #include <QUrl>
    #include <Phonon/VideoPlayer>

    int main()
    QUrl urlVideo = QString("C:\Users\Raphy\Desktop\Aaaah.mp4");
    Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory, 0);

    return 0;


    Thanks for your help !

  • Lifetime Qt Champion

    You are missing a QApplication and creating a memory leak with player not delete before the program returns

  • I found the solution, I created a proper main :

    @#include <QtGui/QApplication>
    #include "newForm.h"

    int main(int argc, char *argv[])
    QApplication app(argc, argv);
    newForm form;
    return app.exec();

    ... and a form containing my Phonon Video Player.

    The most important part using Netbeans, add :

    bq. "QT += phonon"

    in the project properties :

    bq. Build -> Qt -> Custom Definitions

Log in to reply