PlaySound and winmm.lib

Feb 5, 2012 at 4:29pm
Hello everyone! I've read some posts about PlaySound function but I have a question. Where can I get the winmm.lib library? (I can't start my program because the compiler says: "[Linker error] undefined reference to `PlaySoundA@12"). I've searched for it in the Internet but I didn't find it. Can someone provide me with it (I use Dev-C++) or just tell me how to get over my problem? Thanks.
Feb 5, 2012 at 6:53pm
I don't know how you add libraries to Dev-C++, as I use Visual Studio. But I think adding #pragma comment(lib, "winmm.lib") at the top of your code works.

Also, I've read numerous times that Dev-C++ is outdated, so you should concider a new IDE like Visual Studio or Codeblocks. They are both free.
Feb 6, 2012 at 9:25am
OK, but the problem is that I don't have the library file! I've already tried under CodeBlocks and it hasn't the lib file again! I need the "winmm.lib" file, because I can't find it anywhere around the Internet. Thanks for the help.
Feb 6, 2012 at 1:21pm
You need to have the Windows API installed, and link against winmm.
Feb 6, 2012 at 2:52pm
You need libwinmm.a that can be downloaded from here:
http://tdragon.net/recentgcc/
Set your IDE to use this and dev-cpp will be just like any newer ide, not a crap one.
Feb 13, 2012 at 8:20pm
Actually, later I solved my problem. It should be written -lwinmm in the linker. Thank you for the help and advices.
Topic archived. No new replies allowed.