0

The following steps tell how to create a project file to play a wav sound file
1- create a project file.

2-Choose Console Application in Basic tab.

3-After Create the Project File go to Project Option

4-Choose Parameter tab

5-Click the Add Library or Object

6-Browse the location of Dev-c++ lib and choose the libwinmm

7-click ok and exit the Project Option

8-type the below source code

#include <windows.h>
#include <mmsystem.h>
#include <conio.h>

using namespace std;

int main(int argc, char *argv[])
{
PlaySound("chimes.wav",NULL,SND_FILENAME|SND_ASYNC);//PLAY WAV SOUND ONCE

//PlaySound("chimes.wav",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);
//ANOTHER OPTION PLAY REPEATED WAV SOUND

getch(); 
return 0;
}

Now my problem statement is to just create a C or Cpp file to play the wav file by not creating a project.I have tried a lot but couldn't do so.The reason probably might be with adding libwinmm to the program.The above procedure tells about adding it to project but how shall I do the same if I want to play it just in a file.(I mean what about libwinmm)

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by penguina888
0

If you're trying to compile this at the command line, then it would be something like gcc prog.c -lwinmm where the winmm specifies the name of the library to link with, in this case libwinmm.a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.