Проект здания C с PortAudio

Я решил портировать свой аудиопроект на C и преуспел в использовании библиотеки SDL. Я хотел бы использовать ASIO, который предоставляется PortAudio, поэтому я построил PortAudio с поддержкой ASIO без ошибок. Когда я включаю portaudio.h, добавляю библиотеку -lportaudio к компоновщику, собираю все и запускаю, проблем нет. Но когда я пытаюсь вызвать любую из функций portaudio (Pa_InitializeНапример, я получаю этот вывод:

08:27:54 **** Incremental Build of configuration Debug for project PortAudioTest ****
Info: Internal Builder is used for build
gcc -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "..\\main.c"
gcc -o PortAudioTest.exe main.o -lportaudio
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_util.o): In function `PaUtil_GetTime':
D:\Dokumenty\Downloads\portaudio/src/os/win/pa_win_util.c:148: undefined reference to `timeGetTime@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `AdvanceToNextOutputBuffer':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2733: undefined reference to `waveOutWrite@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2739: undefined reference to `waveOutGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `AdvanceToNextInputBuffer':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2706: undefined reference to `waveInAddBuffer@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2712: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `StopStream':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3538: undefined reference to `waveOutReset@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3542: undefined reference to `waveOutGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3551: undefined reference to `waveInReset@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3555: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `ProcessingThreadProc':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2968: undefined reference to `waveOutGetPosition@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `TerminateWaveHeaders':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2099: undefined reference to `waveInUnprepareHeader@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2101: undefined reference to `waveOutUnprepareHeader@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `QueryOutputWaveFormatEx':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:543: undefined reference to `waveOutOpen@24'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:559: undefined reference to `waveOutGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `QueryInputWaveFormatEx':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:517: undefined reference to `waveInOpen@24'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:533: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `InitializeWaveHeaders':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2049: undefined reference to `waveInPrepareHeader@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2059: undefined reference to `waveOutPrepareHeader@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:2063: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `AbortStream':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3597: undefined reference to `waveOutReset@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3600: undefined reference to `waveOutGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3610: undefined reference to `waveInReset@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3613: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `StartStream':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3235: undefined reference to `waveInAddBuffer@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3239: undefined reference to `waveInGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3252: undefined reference to `waveOutPause@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3327: undefined reference to `waveOutGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3323: undefined reference to `waveOutWrite@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3388: undefined reference to `waveInStart@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3393: undefined reference to `waveInGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3403: undefined reference to `waveOutRestart@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:3406: undefined reference to `waveOutGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `TerminateWaveHandles':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1940: undefined reference to `waveInClose@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1958: undefined reference to `waveInGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1947: undefined reference to `waveOutClose@4'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1962: undefined reference to `waveOutGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `InitializeWaveHandles':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1860: undefined reference to `waveInOpen@24'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1910: undefined reference to `waveOutGetErrorTextA@12'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1866: undefined reference to `waveOutOpen@24'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:1906: undefined reference to `waveInGetErrorTextA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `PaWinMme_Initialize':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:976: undefined reference to `waveInMessage@16'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:980: undefined reference to `waveOutMessage@16'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:984: undefined reference to `waveInGetNumDevs@0'
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:988: undefined reference to `waveOutGetNumDevs@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `InitializeInputDeviceInfo':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:692: undefined reference to `waveInGetDevCapsA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `InitializeOutputDeviceInfo':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:820: undefined reference to `waveOutGetDevCapsA@12'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_wmme.o): In function `PaWinMme_Initialize':
D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c:988: undefined reference to `waveOutGetNumDevs@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o): In function `Terminate':
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1409: undefined reference to `operator delete(void*)'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o): In function `GetStreamTime':
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:3538: undefined reference to `timeGetTime@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o): In function `PaAsio_Initialize':
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1382: undefined reference to `operator delete(void*)'
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1216: undefined reference to `operator new(unsigned int)'
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1216: undefined reference to `operator delete(void*)'
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1218: undefined reference to `__cxa_get_exception_ptr'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o): In function `bad_alloc':
c:/mingw/lib/gcc/mingw32/4.8.1/include/c++/new:54: undefined reference to `vtable for std::bad_alloc'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o): In function `PaAsio_Initialize':
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1218: undefined reference to `__cxa_begin_catch'
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1218: undefined reference to `std::bad_alloc::~bad_alloc()'
D:\Dokumenty\Downloads\portaudio/src/hostapi/asio/pa_asio.cpp:1218: undefined reference to `__cxa_end_catch'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o):pa_asio.cpp:(.rdata$_ZTISt9exception[__ZTISt9exception]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o):pa_asio.cpp:(.rdata$_ZTISt9bad_alloc[__ZTISt9bad_alloc]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_asio.o):pa_asio.cpp:(.eh_frame+0x6f7): undefined reference to `__gxx_personality_v0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_coinitialize.o): In function `PaWinUtil_CoInitialize':
D:\Dokumenty\Downloads\portaudio/src/os/win/pa_win_coinitialize.c:79: undefined reference to `CoInitialize@4'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(pa_win_coinitialize.o): In function `PaWinUtil_CoUninitialize':
D:\Dokumenty\Downloads\portaudio/src/os/win/pa_win_coinitialize.c:139: undefined reference to `CoUninitialize@0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTI8IUnknown[__ZTI8IUnknown]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTI5IASIO[__ZTI5IASIO]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTI21IASIOThiscallResolver[__ZTI21IASIOThiscallResolver]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV8IUnknown[__ZTV8IUnknown]+0x8): undefined reference to `__cxa_pure_virtual'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV8IUnknown[__ZTV8IUnknown]+0xc): undefined reference to `__cxa_pure_virtual'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV8IUnknown[__ZTV8IUnknown]+0x10): undefined reference to `__cxa_pure_virtual'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV5IASIO[__ZTV5IASIO]+0x8): undefined reference to `__cxa_pure_virtual'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV5IASIO[__ZTV5IASIO]+0xc): undefined reference to `__cxa_pure_virtual'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(iasiothiscallresolver.o):iasiothiscallresolver.cpp:(.rdata$_ZTV5IASIO[__ZTV5IASIO]+0x10): more undefined references to `__cxa_pure_virtual' follow
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiodrivers.o): In function `Z14loadAsioDriverPc':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/asiodrivers.cpp:11: undefined reference to `operator new(unsigned int)'
C:/MinGW/msys/1.0/asio/ASIOSDK/host/asiodrivers.cpp:11: undefined reference to `operator delete(void*)'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiodrivers.o):asiodrivers.cpp:(.eh_frame+0xff): undefined reference to `__gxx_personality_v0'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiolist.o): In function `deleteDrvStruct':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:111: undefined reference to `operator delete(void*)'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiolist.o): In function `newDrvStruct':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:75: undefined reference to `operator new[](unsigned int)'
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:80: undefined reference to `CLSIDFromString@8'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiolist.o): In function `ZN14AsioDriverListC2Ev':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:157: undefined reference to `CoInitialize@4'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiolist.o): In function `ZN14AsioDriverList14asioOpenDriverEiPPv':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:184: undefined reference to `CoCreateInstance@20'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libportaudio.a(asiolist.o): In function `ZN14AsioDriverListD2Ev':
C:/MinGW/msys/1.0/asio/ASIOSDK/host/pc/asiolist.cpp:164: undefined reference to `CoUninitialize@0'
collect2.exe: error: ld returned 1 exit status

08:27:55 Build Finished (took 858ms)

Я использую 32-битную MinGW с Eclipse на Windows 10 64-битной.

Я тоже не очень понимаю, почему portaudio заголовки из D:\Dokumenty\Downloads\portaudio используются. При сборке с MSYS я использовал ./configure --prefix=/mingw, библиотеки и включения присутствуют в моих каталогах MinGW.

Заранее спасибо за любые подсказки.

1 ответ

когда я пытаюсь вызвать любую из функций portaudio (Pa_Initialize), я получаю [link error]

Ладно, ошибки в ссылках вообще отсутствуют библиотеки.

undefined reference to `__cxa_pure_virtual'

... можно исправить, добавив стандартную библиотеку C++, возможно -lstdc++

и неопределенная ссылка на `waveOutGetNumDevs @ 0 '

... можно исправить, добавив libwinmm.a или похожие.

почему portaudio заголовки из D:\Dokumenty\Downloads\portaudio используются

Они представляют источник, скомпилированный в libportaudio, Когда он был построен, он содержал исходные файлы, такие как D:\Dokumenty\Downloads\portaudio/src/hostapi/wmme/pa_win_wmme.c который сделал ссылку на такие функции, как waveOutWrite(), Теперь, когда вы используете libportaudio чтобы сделать исполняемый файл, вы должны предоставить компоновщику библиотеки, необходимые для разрешения всех этих зависимостей.

Другие вопросы по тегам