How to play sounds in Dev C++?

Hi all. I'm currently playing around with the PlaySound API in windows.h, with difficulty lol. If anyone out there can gimme a hand to successfully play a sound file stored on my PC with this API, or by another means, that would be kewl. Thanks in advance.
How about this:
 
PlaySound("C:/WINDOWS/Media/ding.wav", NULL, SND_FILENAME);

Does that give you an idea of how to use it?

If that does not help, please go into more detail about the difficulty you are having.
Last edited on
Thanks for the reply. I tried that particular line, yet I still generate an error. Here is the entire code im using.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <windows.h>
#include <stdlib.h>

using namespace std;

int main()
{
    PlaySound("C:/WINDOWS/Media/ding.wav", NULL, SND_FILENAME);

    system("PAUSE");    
    return 0;
}


I get [Linker error] undefined reference to `PlaySoundA@12'

Any ideas on the problemo? thanks
Just in case anyone else has the same problem, I thought i'd post the solution. The above code is PERFECT, nothing wrong with it at all. You dont have to add any other dll's or include any other headers. Just go to project > project options > parameters and type "-lwinmm" in the LINKER section. As far as I have rationalized it (which may or may not be true lol), this links the winmm.lib library to the project, so that the PlaySound function (which is located in windows.h) may successfully execute.
i tried your code but there are some fewc error..

i looked at the project> but i ddnt saw "project option "
what am i do to execute this program>>>>
Topic archived. No new replies allowed.