Problem with PlaySound

I've wanted to use music for when the program starts, but it doesn't work. Here's the problem it returns [http://i.imgur.com/mEfSry5.png] , and below the code.

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

using namespace std;

int main(){
LPCSTR file = "C:\\Windows\\Users\\Desktop\\Tic Tac Toe folder\\music.wav";
PlaySound(file, GetModuleHandle(NULL), (SND_FILENAME));
return 0;
}
You're not linking against the library containing that function. See here: https://msdn.microsoft.com/en-gb/library/windows/desktop/dd743680(v=vs.85).aspx

The library to link against is listed towards the bottom.

ok, thanks.
I don't have the .lib file or the .dll. Where can I find it (I have Code::Blocks, not visual Studio)
In g++, the library if it exists will probably be named "libwinmm.a"

Try adding to the linker options -lwinmm
It's a windows library. Do you have windows?
Oh right, thanks!
Topic archived. No new replies allowed.