尝试通过 QSound(QT 5,Ubuntu 13.04)播放声音
代码:
#include <QtMultimedia/QSound>
void MainWindow::on_pushButton_2_clicked()
{
QSound::play("sounds/win.wav");
}
并出现 2 个错误: 对“QSound::play(QString const&)”的 undefined reference collect2:错误:ld 返回 1 退出状态
我做错了什么?在 documentation here我看到了相同的代码。
最佳答案
您需要包含多媒体模块。将此添加到您的 .pro 文件中:
QT += multimedia
关于qt - 对 `QSound::play(QString const&)' 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16637686/