【问题标题】:Using non-qtcore libraries on Visual Studio using Qt VS Tools causes LNK2019使用 Qt VS Tools 在 Visual Studio 上使用非 qtcore 库会导致 LNK2019
【发布时间】:2021-08-02 02:56:21
【问题描述】:

我正在尝试使用来自 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$3" (?dtor$3@?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 Tools 扩展处理,所以我有点困惑。

【问题讨论】:

    标签: c++ qt qtmultimedia qt-vs-addin


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-09
      • 1970-01-01
      • 2016-02-11
      相关资源
      最近更新 更多