Why dose this not work?

Error message is:
[Linker error] undefined reference to `PlaySoundA@12'
ld returned 1 exit status

Cunk of Code:
if(LOWORD(wParam) == ID_Option){
PlaySound("Skillet-Hero", NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);

Why dose this not work?

Because there is an undefinined reference to PlaySoundA. Do a MSDN search for PlaySound(), and down in the fine print down at the bottom of the function description you'll find listed the required import library winmm.lib. So you need to do whatever it is that you have to do with whatever development environment you are using to add a reference to that library. Then, you won't have an 'undefined reference to PlaySound@12'.
Last edited on
How would I play music files, with Dev bloodshed compiler, without downloading anything or changing anything, maybe including a built in library though? Just trust me when I say I have no other options for now.
As freddie1 said. You have to link your project/program to the winmm library. You need an import library [http://en.wikipedia.org/wiki/Dynamic-link_library#Import_libraries] to do so.

The step to do that is specific to your compiler/IDE. In your case (Dev-C++), this link might be useful http://sourceforge.net/p/dev-cpp/discussion/128327/thread/1baf9670/

Hope that helps!! Goodluck!!
Topic archived. No new replies allowed.