mciSendString上的一些问题。

#include
#include
int main(void)
{
mciSendString("open\"F:\works\srkl.mp3\" alias file", NULL, 0, NULL);
mciSendString("play file", NULL, 0, NULL);
getchar();
}

编译不成功
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\86131\AppData\Local\Temp\cc6Z7VzD.o:1.c:(.text+0x36): undefined reference to `mciSendStringA@16'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\86131\AppData\Local\Temp\cc6Z7VzD.o:1.c:(.text+0x5d): undefined reference to `mciSendStringA@16'
collect2.exe: error: ld returned 1 exit status
这个要看你用的是什么编译器,包含的是什么头文件,链接的lib文件,还有你是不是编译成x64代码了,你的头文件包含的是mciSendStringA,那么是不是ANSI字符集版本的程序,unicode用mciSendStringW

如果是VC++,需要加上
#include"mmsystem.h"     
#pragma comment(lib,"winmm.lib")