I am trying to get in touch with the DirectX SDK. I managed to install it, created a new Win32 Console Project
and added following lines
#include <iostream>
#include <xaudio2.h>
int main(int argc, char *argv[]){
IXAudio2* pXAudio = 0;
IXAudio2MasteringVoice *pXAudioMasterVoice = 0;
HRESULT hr;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = XAudio2Create(&pXAudio, 0, XAUDIO2_DEFAULT_PROCESSOR);
if(FAILED(hr)){
CoUninitialize();
return hr;
}
hr = pXAudio->CreateMasteringVoice(&pXAudioMasterVoice);
if(FAILED(hr)){
pXAudio->Release();
CoUninitialize();
return hr;
}
CoUninitialize();
std::cout << "Done!" << std::endl;
}
The documentation says, that there is no xaudio2.lib
to link to, but it is a COM
-object, but I get LNK2019 - unresolved external symbol "__imp__XAudio2Create@12"
Here is the documentation.
Thank you for any hints.
XAudio2Create is not COM, it's a standard DLL export, so you do need to link with Xaudio2.lib. This library is available in %Program Files%\Windows Kits\8.0\Lib\win8\um
(installed with the Windows 8 SDK).