为甚播放不了背景音乐?

时间:2022-09-28 05:03:30
为甚播放不了背景音乐?为什么就是播放不了呢?设备是耳机,代码没问题。编译器链接设置好了,sounds文件是放在Debug文件下的。而且sounds文件里都有WAV格式的音乐文件。(图片里的头文件稍微有点改动。)
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")

int main()
{
    PlaySound(TEXT("sounds\\刚认识你.wav"),
                NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
    Sleep(10000);
    printf("Hello world!\n");
    return 0;
}

1 个解决方案

#1


SetCurrentDirectory
GetLastError

#1


SetCurrentDirectory
GetLastError