#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <mmsystem.h>//导入声音头文件
#pragma comment(lib,"Winmm.lib")
#include <stdlib.h>
#include <windows.h>
#include <mmsystem.h>//导入声音头文件
#pragma comment(lib,"Winmm.lib")
int main(void)
{
//printf("Hello world!\n");
//播放音乐
PlaySound("sounds\\背景音乐.wav",NULL,SND_FILENAME | SND_ASYNC | SND_LOOP);
system("pause");
return 0;
}
其中sounds文件放在自己创建工程中的bin文件夹下例如:D:\C语言学习\EmperorDemo\bin\Debug\sounds