Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSound problems, mySoundObj.play() and QSound::play(fileName) won't compile. [solved, added QT += multimedia]



  • QSound::play("TimerBeep.wav");

    Produces the following errors on compilation

    C:\SkyDrive\QT_Projects\build-TimerReminder-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\TimerMessageDialog.o:-1: In function `ZN18TimerMessageDialog10UpdateBeepEv':

    C:\SkyDrive\QT_Projects\TimerReminder\TimerMessageDialog.cpp:58: error: undefined reference to `_imp___ZN6QSound4playERK7QString'

    C:\SkyDrive\QT_Projects\build-TimerReminder-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\TimerMessageDialog.o:-1: In function `_tcf_0':

    C:\SkyDrive\QT_Projects\TimerReminder\TimerMessageDialog.cpp:4: error: undefined reference to `_imp___ZN6QSoundD1Ev'

    gSound.play();

    produces the following errors on compilation

    C:\SkyDrive\QT_Projects\build-TimerReminder-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\TimerMessageDialog.o:-1: In function `ZN18TimerMessageDialog10UpdateBeepEv':

    C:\SkyDrive\QT_Projects\TimerReminder\TimerMessageDialog.cpp:58: error: undefined reference to `_imp___ZN6QSound4playEv'

    C:\SkyDrive\QT_Projects\build-TimerReminder-Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug\TimerMessageDialog.o:-1: In function `_tcf_0':

    What's going on here, if I comment this play line out everything compiles fine, even the constructor for QSound on my global object.

    [solved, added QT += multimedia]


Log in to reply