XAudio2

Oct 3, 2023 at 2:13pm
When initializing xAudio2 in Eclipse there comes an error: undefined reference to `XAudio2Create'.

1
2
3
    IXAudio2* pXAudio2 = nullptr;
    if (FAILED(hr = XAudio2Create(&pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
        cout << hr;


What is causing this, and what is the solution?
Last edited on Oct 3, 2023 at 5:53pm
Oct 3, 2023 at 6:21pm
Sound like a linker error. Probably you did not link the required import library.

Try linking with Xaudio2.lib, as described here:
https://learn.microsoft.com/en-us/windows/win32/api/xaudio2/nf-xaudio2-xaudio2create#requirements
Last edited on Oct 3, 2023 at 6:21pm
Topic archived. No new replies allowed.