-
Playing a sound file
I tried this code when the window loads to play a sound file which placed in the directory where my source files are:
Code:
case WM_CREATE:
PlaySound("hellowin.wav" ,NULL,SND_FILENAME | SND_ASYNC);
return 0;
It gives me this error:
hellowin.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA@12
-
Try adding winmm.lib to the list of libraries (under Project Settings)
-
THanks a lot
That works now!
But Why did I need that library?
-
LOL @ the sig :D
Because the library doesn't contain any code, only the definitions for the functions. You'll notice that each library roughtly corresponds to each DLL. Since PlaySound is in winmm.dll (or something similar), it's logical for it to be in winmm.lib. Likewise, Sleep (kernel32.dll) is in kernel32.lib :)