Pelles C forum

Pelles C => Bug reports => Topic started by: athene4 on September 17, 2014, 08:22:29 PM

Title: PlaySound POLINK error
Post by: athene4 on September 17, 2014, 08:22:29 PM
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>
Title: Re: PlaySound POLINK error
Post by: neo313 on September 17, 2014, 08:37:11 PM
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

Title: Re: PlaySound POLINK error
Post by: athene4 on September 17, 2014, 10:17:59 PM
Thank you, it works well using Winmm.lib!
NB. Flag constants ('SND_FILENAME' etc.) are declared in <mmsystem.h> so I must include it.
Title: Re: PlaySound POLINK error
Post by: neo313 on September 18, 2014, 04:02:32 AM
No, windows.h automatically includes appropriate headers.
Title: Re: PlaySound POLINK error
Post by: athene4 on September 18, 2014, 10:28:42 AM
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!