#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
PlaySound ("test.wav",NULL, SND_SYNC);
return 0;
}
errors :
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
PlaySound ("test.wav",NULL, SND_SYNC);
return 0;
}
errors :
Your project is configured to use Unicode version of Windows API, but your source files are in ASCII.
To solve this problem without messing with configuration, simply specify the string constants to be Unicode like this:
PlaySound (L"test.wav",NULL, SND_SYNC);
Notice the L
before the string constant.
Alternatively, you could call the ASCII version of the API directly:
PlaySoundA("test.wav",NULL, SND_SYNC);
It is the same function name but ends with an A
.
This is not recommended however, for compatibility reasons.