Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I installed libao-dev and mpg123 with

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? Or what do I need to include, to get g++ find the mpg123 library? Libao library seems to be found... Playing an mp3 file using "mpg123 text.pm3" works. But I searched the complete file structure for "mpg123.h" but the file doesn't exist. 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?

Thanks for any help :-)!

like image 722
Jonny Avatar asked Jan 09 '23 17:01

Jonny


1 Answers

You probably missing to install the dev package associated to libmpg123

sudo apt-get install libmpg123-dev

[Useful feature]

If you search a package with APT used

sudo apt-cache search [package]

For example with mpg123 you can found easily the development package ;)

like image 94
DeadCalimero Avatar answered Jan 22 '23 17:01

DeadCalimero