2013-05-19 28 views
2

試圖播放聲音,經由QSound的(QT 5,Ubuntu的13.04)未定義參考`QSound的::播放(QString的常量&)」

的代碼:

#include <QtMultimedia/QSound> 
void MainWindow::on_pushButton_2_clicked() 
{ 
QSound::play("sounds/win.wav"); 
} 

並得到2個錯誤: 未定義的參考`的QSound ::播放(QString的常量&)」 collect2:錯誤:LD返回1退出狀態

我到底做錯了什麼?在documentation here我看到相同的代碼。

回答

3

您需要包含多媒體模塊。將其添加到.pro文件中:

QT += multimedia