News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

PlaySound POLINK error

Started by athene4, September 17, 2014, 08:22:29 PM

Previous topic - Next topic

athene4

I tried the following code snippet from Petzold:

case WM_CREATE:
   PlaySound(TEXT("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
   return 0 ;

And got the following POLINK: error: Unresolved external symbol '__imp_PlaySoundA'.
Version 8.00.19 Release Candidate #6 (Win64), included <windows.h>, <mmsystem.h>

neo313

This is not a bug.

Do not include <mmsystem.h>.  Including windows.h is all you need to do.

Add >>  Winmm.lib << to: Project options->Linker->Library and object files


athene4

Thank you, it works well using Winmm.lib!
NB. Flag constants ('SND_FILENAME' etc.) are declared in <mmsystem.h> so I must include it.

neo313

No, windows.h automatically includes appropriate headers.

athene4

It looks it was a side effect of #define WIN32_LEAN_AND_MEAN (from a program template).
I remove it along with <mmsystem.h>.
Thanks!