DEV C++ C语言项目,编译到mciSendString两条代码就报错 求指点!

2025-04-07 17:14:55
推荐回答(1个)
回答1:

不要傻呼呼以为 头文件一甩就完事了,
链接上对应的lib文件才是重点,
一下copy自msdn

The mciSendString function sends a command string to an MCI device.
The device that the command is sent to is specified in the command string.
MCIERROR mciSendString(
LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback
);

Parameters

lpszCommand
......

Requirements

Windows NT/2000: Requires Windows NT 3.1 or later.
Windows
95/98: Requires Windows 95 or later.
Header: Declared in
Mmsystem.h.
Library: Use Winmm.lib. ------------- vc把这个链接上 mingw对应是libwinmm.a
Unicode: Implemented
as Unicode and ANSI versions on Windows NT/2000.
#pragma comment(lib, "Winmm.lib") m$自家vc 编译器cl.exe专有 宏指令,别家的不认
编译选项 连接 中添加 -lwinmm 能过通过连接,win7貌似编译连接正确也不能播放,不兼容