简体   繁体   中英

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

I am trying to use QSoundEffect from QtMultimedia. I have included the file like so:

#include <QtMultimedia/QSoundEffect>

and used QSoundEffect in my project.

When I try to compile my project after this, I get LNK2019 errors:

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)

How can I tell Visual Studio about the existence of QtMultimedia related files? Qt include and library paths are handled by the Qt VS Tools extension in Visual Studio, so I'm a bit confused.

For some weird reason, it worked when I manually added Qt5's libpath to library paths and Qt5Multimedia.lib to included libraries manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM