创建新工程的时候,最好不要带中文路径.否则就会出你说的这个问题.
比如说你在C:\playsound目录下面创建一个工程.
#include <windows.h>
#include <mmsystem.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
PlaySound("C:/windows/media/tada.wav", NULL, 1);
MessageBox(NULL, "hello", "this", MB_OK);
return 0;
}
测试了一下,c-free在构建选项/链结那里添不添加winmm都没有关系,可以正常链结.
要添加,只需要输入"winmm"就行了,不用选择路径.