I'm trying to play sounds in my C++ app. We were given a guide to using XACT for it but I can't get it to work so I'm trying to use the PlaySound functions.
This is what i've tried. I've also tried it with the whole directory link to where it is saved.
int main() {
PlaySound("background.mp3", NULL, SND_SYNC);
}
This is the errors it throws up
Error 7 error LNK2019: unresolved external symbol __imp__PlaySoundA@12 referenced in function _main C:\Users\Siyico\Desktop\Legit\w9base\wingl2013_14\SpaceGame.obj wingl2013_14
Error 8 error LNK1120: 1 unresolved externals C:\Users\Siyico\Desktop\Legit\w9base\Debug\wingl2013_14.exe 1 1 wingl2013_14
The problem is that you don't have any source code that implements PlaySound. You need to link to a library provided by Microsoft to do that. In this case the library is winmm.lib. Thus you need to add a reference to winmm.lib to your linker settings.
To do that, right-click on your project and select properties. Then go to the linker->input item. Add ";winmm.lib
" to the end of the Additional Dependencies box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With