Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Struggling to get PortAudio to Work with MinGW

Tags:

c

mingw

portaudio

I have the MinGW install previously working fine with MSYS. They are installed properly and functioning just well.

I installed the PortAudio library and did the install and got the success message after:

./configure
make
make install 

When I try to compile samples:

c:\c>gcc patest_mono.c -o pa.exe
patest_mono.c:50:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^
compilation terminated.

I'm new. I have a feeling I might be doing something fundamentally wrong with the way I'm trying to create the exe from compiling. It's been somewhat of a puzzle quest so far, but I've tried to figure it out and think I am close but completely missing something.

PATH variable ?

In the PortAudio MinGW build instructions I noticed

"The above should create a working version though you might want to    
provide  '–prefix=<path-to-install-dir>' to configure. "

I've tried adding C:\MingW\PortAudio into the user path. Doesn't work.

I've also tried running the commands in Bash and they come back with an error message "No Rule to make target 'paexpink'" either with the make command, and with gcc .c -o .exe I just get the same error message as compiling straight from the cmd prompt.

I found another source on stack overflow thread with no answers, but the user had commented that http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio provided them a solution but I tried installing the 5 cpython binaries and under the assumption I did it right, it didn't work either.

Thanks for your help, Julian

like image 462
Julian73 Avatar asked Oct 24 '25 04:10

Julian73


1 Answers

To build and install portaudio, you need to add -prefix=/c/<"path to base of the MinGW directory"> to the ./configure line.

For example: ./configure -prefix=/c/MinGW/

then continue the installation by doing

make

After that, do the

make install

and that should install the portaudio files into MinGW.

After it has finished installing, you need to add -lportaudio to the compile command whenever you compile any programs that you want to use PortAudio in.

For example: gcc -o test test.c -lportaudio

I just figured out how to do this today, so I may have accidentally forgotten a few steps.

like image 193
0x3F Avatar answered Oct 26 '25 19:10

0x3F