What is wrong with that? # Include <iostream>
# Include <fstream>
# Include <string>
# Include ("winmm.lib)
using namespace std;
int main ()
(
PlaySound ("Blackjack - Ban.wav Bang", NULL, SND_FILENAME | SND_LOOP);
return 0;
)
He told my compiler "" SND_FILENAME 'undeclared (first use in this function). Can someone please fill in the gaps and tell me where I am wrong
This "# include (" winmm.lib ") is false.
[Code]
# Include <iostream>
# Include <fstream>
# Include <string>
# Include <windows.h>
lib # pragma comment ("winmm.lib)
using namespace std;
int main ()
(
PlaySound ("Blackjack - Ban.wav Bang", NULL, SND_FILENAME | SND_LOOP);
return 0;
)
[/ Code]
What to do with this code is to create a "new project," and yes, it can be a console project. Then add the above file for the project, you must use the project options, the options for the linker: (In Dev, you must add what is below, under the direction of being This file path on your machine.)
"C: \ Dev-Cpp \ lib \ libwinmm.a"
You have a few problems here.
As mentioned earlier, you call winmm.lib via pragma comment:
lib # pragma comment ("winmm.lib");
In addition, you've missed using the file argument function PlaySound.
The first argument of the function PlaySound is the full path to your wav file, the full path is the folder structure and file name, eg C: \ Documents and Settings \ yourname \ My Documents \ My Music \ FileName wav.
eh
This is not the conclusion of SND_FILENAME symbol in one of your header files or library that you link / including. Try using iostream.h, string.h, and fstream.h not iostream, string and fstream (assuming it is C or C + + and not Java). Just an idea.
I think you can use your linker / makefile, not your compiler to include winmm.lib, but my programming skills are really rusty.
That's all I can think of.
Good luck.
Posted on August 9, 2010.