简体   繁体   English

用mpg123和c ++在树莓上播放mp3

[英]Play mp3 on raspberry with mpg123 and c++

I want to use the following example program: http://hzqtc.github.io/2012/05/play-mp3-with-libmpg123-and-libao.html it uses 我想使用以下示例程序: http//hzqtc.github.io/2012/05/play-mp3-with-libmpg123-and-libao.html它使用

#include <ao/ao.h> 
#include <mpg123.h>    

I installed libao-dev and mpg123 with 我安装了libao-dev和mpg123

sudo apt-get install libao-dev
sudo apt-get install mpg123

and then build the file with 然后使用。构建文件

gcc -O2 -o play play.c -lmpg123 -lao

I get the following error 我收到以下错误

"fatal error: mpg123.h no such file or directory". 

Do I need to install another mpg123 development package or build the package myself from source on the raspberry to get a working library? 我是否需要安装另一个mpg123开发包,或者自己从raspberry上的源代码构建包来获得一个工作库? Or what do I need to include, to get g++ find the mpg123 library? 或者我需要包括什么,让g ++找到mpg123库? Libao library seems to be found... Playing an mp3 file using "mpg123 text.pm3" works. Libao图书馆好像被发现了...使用“mpg123 text.pm3”播放mp3文件。 But I searched the complete file structure for "mpg123.h" but the file doesn't exist. 但我搜索了完整的文件结构“mpg123.h”,但该文件不存在。 So I assume I need some additional program to be installed that includes the library, can anyone help me which one it is? 所以我假设我需要安装一些包含库的附加程序,任何人都可以帮助我这是哪一个? Or is only option to build mpg123 from source? 或者只是从源代码构建mpg123的选项?

Thanks for any help :-)! 谢谢你的帮助 :-)!

You probably missing to install the dev package associated to libmpg123 您可能缺少安装与libmpg123关联的开发包

sudo apt-get install libmpg123-dev

[Useful feature] [实用功能]

If you search a package with APT used 如果您使用APT搜索包裹

sudo apt-cache search [package]

For example with mpg123 you can found easily the development package ;) 例如使用mpg123,您可以轻松找到开发包;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM