使用 Qt VS Tools 在 Visual Studio 上使用非 qtcore 库会导致 LNK2019

Using non-qtcore libraries on Visual Studio using Qt VS Tools causes LNK2019

我正在尝试使用 QtMultimedia 的 QSoundEffect。我已经包含了这样的文件:

#include <QtMultimedia/QSoundEffect>

并在我的项目中使用了 QSoundEffect。

在此之后尝试编译我的项目时,出现 LNK2019 错误:

1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSoundEffect::QSoundEffect(class QObject *)" (__imp_??0QSoundEffect@@QEAA@PEAVQObject@@@Z) referenced in function "public: __cdecl ChatWindow::ChatWindow(class QWidget *)" (??0ChatWindow@@QEAA@PEAVQWidget@@@Z)
1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSoundEffect::~QSoundEffect(void)" (__imp_??1QSoundEffect@@UEAA@XZ) referenced in function "int `public: __cdecl ChatWindow::ChatWindow(class QWidget *)'::`1'::dtor" (?dtor@?0???0ChatWindow@@QEAA@PEAVQWidget@@@Z@4HA)
1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSoundEffect::setSource(class QUrl const &)" (__imp_?setSource@QSoundEffect@@QEAAXAEBVQUrl@@@Z) referenced in function "public: __cdecl ChatWindow::ChatWindow(class QWidget *)" (??0ChatWindow@@QEAA@PEAVQWidget@@@Z)
1>mainwidget.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSoundEffect::play(void)" (__imp_?play@QSoundEffect@@QEAAXXZ) referenced in function "private: void __cdecl MainWidget::process_received_forever(void)" (?process_received_forever@MainWidget@@AEAAXXZ)

如何告诉Visual Studio QtMultimedia 相关文件的存在? Qt 包含和库路径由 Visual Studio 中的 Qt VS 工具扩展处理,所以我有点困惑。

出于某些奇怪的原因,当我手动将 Qt5 的 libpath 添加到库路径并将 Qt5Multimedia.lib 手动添加到包含的库时,它起作用了。