QSoundオブジェクトからサウンドを再生しようとしています。前の例を見ると、なぜ機能しないのかわかりません
これはヘッダーです
#ifndef ACCESSPANEL_H
#define ACCESSPANEL_H
#include <QWidget>
#include "theislandmain.h"
#include <QString>
#include <QtMultimedia/QSound>
namespace Ui {
class accessPanel;
}
class accessPanel : public QWidget
{
Q_OBJECT
public:
explicit accessPanel(QWidget *parent = 0);
~accessPanel();
private slots:
QString getCode();
void on_one_clicked();
void on_two_clicked();
void on_three_clicked();
void on_four_clicked();
void on_five_clicked();
void on_six_clicked();
void on_seven_clicked();
void on_eight_clicked();
void on_nine_clicked();
void on_cancel_clicked();
void on_zero_clicked();
void on_confirm_clicked();
private:
Ui::accessPanel *ui;
QString input;
QSound *keypad;
};
#endif // ACCESSPANEL_H
これがメインです
#include "accesspanel.h"
#include "ui_accesspanel.h"
#include <QtMultimedia/QSound>
accessPanel::accessPanel(QWidget *parent) :
QWidget(parent),
ui(new Ui::accessPanel)
{
ui->setupUi(this);
keypad = new QSound("../Island/Sounds/keypad.wav", this);
}
accessPanel::~accessPanel()
{
delete ui;
}
QString accessPanel::getCode()
{
return input;
}
void accessPanel::on_one_clicked()
{
keypad->play();
input = input + "1";
ui->codeDisplay->setText(input);
}
void accessPanel::on_two_clicked()
{
input = input + "2";
ui->codeDisplay->setText(input);
}
void accessPanel::on_three_clicked()
{
input = input + "3";
ui->codeDisplay->setText(input);
}
void accessPanel::on_four_clicked()
{
input = input + "4";
ui->codeDisplay->setText(input);
}
void accessPanel::on_five_clicked()
{
input = input + "5";
ui->codeDisplay->setText(input);
}
void accessPanel::on_six_clicked()
{
input = input + "6";
ui->codeDisplay->setText(input);
}
void accessPanel::on_seven_clicked()
{
input = input + "7";
ui->codeDisplay->setText(input);
}
void accessPanel::on_eight_clicked()
{
input = input + "8";
ui->codeDisplay->setText(input);
}
void accessPanel::on_nine_clicked()
{
input = input + "9";
ui->codeDisplay->setText(input);
}
void accessPanel::on_cancel_clicked()
{
this->close();
input = "";
ui->codeDisplay->clear();
}
void accessPanel::on_zero_clicked()
{
input = input + "0";
ui->codeDisplay->setText(input);
}
void accessPanel::on_confirm_clicked()
{
ui->codeDisplay->setText(input);
TheIslandMain::setInput(input);
this->close();
}
次のエラーが発生します。
accesspanel.obj:-1:エラー:LNK2019:未解決の外部シンボル "__declspec(dllimport)public:void _ thiscall QSound :: play(void)"( _imp_?play @ QSound @@ QAEXXZ)関数 "private:void __thiscall accessPanel :: on_one_clicked(void) "(?on_one_clicked @ accessPanel @@ AAEXXZ)
accesspanel.obj:-1:エラー:LNK2019:未解決の外部シンボル "__declspec(dllimport)public:__thiscall QSound :: QSound(class QString const&、class QObject *)"(_ imp ?? 0QSound @@ QAE @ ABVQString @@ PAVQObject @@@ Z)関数 "public:__thiscall accessPanel :: accessPanel(class QWidget *)"(?? 0accessPanel @@ QAE @ PAVQWidget @@@ Z)で参照されます
accesspanel.obj:-1:エラー:LNK2001:未解決の外部シンボル "public:virtual struct QMetaObject const * __thiscall QSound :: metaObject(void)const"(?metaObject @ QSound @@ UBEPBUQMetaObject @@ XZ)
そしてそれに似た他の3人。
私は以下を試しました
QSound::play("filename");
-同じ問題
私は静的な参照をいじりましたが、次のようなものを手に入れました