使用MinGW播放声音
Playing sound using MinGW
我想使用 mciSendString 在我的应用程序中播放声音。为此,我在Microsoft网站上找到了以下简单片段:
#include "stdafx.h"
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "Winmm.lib")
int _tmain(int argc, _TCHAR* argv[])
{
mciSendString("play MyFile wait", NULL, 0, 0);
mciSendString("close MyFile", NULL, 0, 0);
return 0;
}
我的问题是我不使用Visual Studio。有没有办法通过MinGW编译此示例?
一旦我删除了MSVS主义
#include <windows.h>
int main()
{
mciSendString("play MyFile wait", NULL, 0, 0);
mciSendString("close MyFile", NULL, 0, 0);
return 0;
}
并编译使用
g++ -o test.exe "src\test.o" -lwinmm
根据链接的副本,生成成功。
相关文章:
- 如何在C++中播放声音?
- 有没有办法毫不拖延地播放声音?
- 在不打开应用程序的情况下在MinGW c++中播放声音(.wav)文件
- 如何在QT中飞溅之前播放声音?
- 计时器达到零时如何播放声音?
- 使用MinGW播放声音
- 如何从McIsendstring()中解决此错误并使其播放声音
- 如何在 c++ 中播放声音
- 视觉 在C++中正确使用播放声音功能
- 切换音频设备时播放声音的SDL问题
- 有没有一种简单的方法可以使用SFML在后台线程中播放声音
- 如何使用7.1音频系统sfml播放声音
- 在做其他事情时,在C 中播放声音
- 当Windows XP(32位,SP3)播放声音时,随机应用程序暂停半秒钟
- 在 DirectX Windows 8 应用中播放声音
- C 确定是否播放声音
- 播放 C/C++ 声音的最简单方法
- 无法使用适用于Android的Qt使手机播放声音或振动
- 与CocosDenshion一起按顺序播放声音
- Qt c++在按键时播放声音 - 几秒钟后停止工作