Game Developer

Story of XAudio2 & unresolved external symbol

Category : Win8 Dev · by Jul 24th, 2012

Ok, so I have fixed error I had for over a week now. And actually it was ve-e-ery easy, if you know how to do it of course. If you have started programming on C# you think that all adds for you automagicaly. Once you use SpriteBatch in XNA – d2dcontex is loaded, you use text and d2writefactory is added, you play SoundEffect and XAudio2 is loaded. You don’t even know about this. Until you start doing it on C++ and DirectX.

You always need to specify what dependencies/libraries/references you going to use. I was trying to use XAudio2 and get nice error in this peace of code (this loads XAudio2 engine):

IXAudio2* m_engine;

UINT32 flags = 0;
      XAudio2Create(&m_engine, flags)

error LNK2019: unresolved external symbol __imp__XAudio2Create@12 referenced in function "public: __thiscall XAudio2SoundPlayer::XAudio2SoundPlayer(unsigned int)" (??0XAudio2SoundPlayer@@QAE@I@Z) 

This is Linker Error. This means you use something Linker can’t find. To show linker what you are using you should do this:

Go to:

Project Properties -> Configurations Properties -> Linker ->Input -> Dependencies 

and add the library you going to use. xaudio2.lib; in my case.

That’s it, it’s that easy ! As everything in C++ and DirectX !


(3) comments

7 years ago · Reply

Thank you so much! You solved my problem! I was in the same exact situation as you haha

7 years ago · Reply

Thanks a million!

7 years ago · Reply

Thanks!!! You saved my day! Got everything working until deploying to my WinRT device. You’re a hero!

Leave a Reply

Your email address will not be published.