#include <iostream>
#include <stdlib.h>
#include <mmsystem.h>
#include <string>
#include <windows.h>
#pragma comment (lib, "winmm.lib")
using namespace std;
int main() {
PlaySound(TEXT("Happy Birthday To You.wav"), NULL, SND_SYNC);
system("pause");
return 0;
}
C:\Program Files (x86)\CodeBlocks\MinGW\include\mmsystem.h|905|error: 'DWORD' does not name a type|
C:\Program Files (x86)\CodeBlocks\MinGW\include\mmsystem.h|906|error: 'UINT' does not name a type|
C:\Program Files (x86)\CodeBlocks\MinGW\include\mmsystem.h|907|error: typedef 'UINT' is initialized (use decltype instead)|
It just came up tons of the errors in the header file like these, I linked to -lwinmm
and checked the library, it still pops up.
PS I am using code blocks.
You need to include windows.h
before mmsystem.h
. windows.h
should be first in your includes. mmsystem.h
uses types defined in windows.h
(including DWORD and UINT).