Unresolved external symbol for waveOutGetDevCaps and waveOutGetNumDevs
-
Hi qt people,
I am fairly new to qt and I am trying to retrieve and print out my connected audio devices. However I receive this error when trying to build. I've added my .pro and main.cpp file.
error messages:
-
main.obj:-1: error: LNK2019: unresolved external symbol __imp__waveOutGetNumDevs@0 referenced in function _mai
-
main.obj:-1: error: LNK2019: unresolved external symbol __imp__waveOutGetDevCapsW@12 referenced in function _main
I have tried compiling with Desktop Qt 5.14.2 MSVC2015-17, 32/64bit with no difference. Also tried Mingw-32/64-bit.
.pro file:
TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt win32:LIBS += -lkernel32 -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 SOURCES += \ main.cpp
main.cpp
#include <windows.h> #include <mmsystem.h> #include <iostream> #include <mmeapi.h> using namespace std; int main() { cout << "Hello World!" << endl; int nSoundCardCount = waveOutGetNumDevs(); for (int i = 0; i < nSoundCardCount; i++) { WAVEOUTCAPS woc; waveOutGetDevCaps(i, &woc, sizeof(woc)); cout << woc.szPname << endl; } return 0; }
Any ideas on why this occurs?
Thanks,
Socke -
-
Hi and welcome to devnet,
You are not linking to the Winmm library.
-
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you consider correct so that other forum users may know a solution has been found :-)
-
It's an old habit I kept coming from years ago when the forum was the "Qt Developer Network".