Error compiling PortAudio examples.

(I'm on Ubuntu) I'm trying to run PortAudio examples, but I get a lot of errors (see below). I put the portaudio.h header file in the program directory. I have no idea about this. I think this is a linker error. Please, help!

/tmp/cc5EbTlT.o: In the main': paex_record.c:(.text+0x37e): undefined reference toPa_Initialize 'paex_record.c function :(. text + 0x397): undefined link to Pa_GetDefaultInputDevice' paex_record.c:(.text+0x3de): undefined reference toPa_GetDeviceInfo' paex_record.c :(. text + 0x436): undefined link to Pa_OpenStream' paex_record.c:(.text+0x45a): undefined reference toPa_StartStream 'paex_record.c :(. text + 0x493): undefined link to Pa_Sleep' paex_record.c:(.text+0x4c2): undefined reference toPa_IsStreamActive 'paex_record.c :( text + 0x4eb): undefined link to Pa_CloseStream' paex_record.c:(.text+0x5fa): undefined reference toPa_GetDefaultOutputDevice' paex_record.c :(. Text + 0x641): undefined link to Pa_GetDeviceInfo' paex_record.c:(.text+0x6b2): undefined reference toPa_OpenStream 'paex_record.c :(e + 0x) : undefined link to Pa_StartStream' paex_record.c:(.text+0x71c): undefined reference toPa_Sleep 'paex_record.c :(. text + 0x728): undefined link to Pa_IsStreamActive' paex_record.c:(.text+0x74e): undefined reference toPa_CloseStream' paex_record.c :(. text + 0x77d): undefined link to Pa_Terminate' paex_record.c:(.text+0x7e5): undefined reference toPa_GetErrorText 'collect2: error: ld returned 1 exit status

+4
1

, gcc C foo.c,

gcc -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio

-l , , . -lrt librt.a. .

: http://www.portaudio.com/docs/v19-doxydocs/compile_linux.html#comp_linux3. , . , -lportaudio, .

, gcc , .

gcc -L/usr/lib -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio

, .

#include <portaudio.h>

include:

gcc -I/usr/include -L/usr/lib -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio

, Makefile.

+1

Source: https://habr.com/ru/post/1610442/


All Articles