2017-10-23 40 views
1

私はこのcmakeのリストを持っています問題は、私は、コードのこの作品に対するエラーメッセージerror: undefined reference to Pa_GetVersion'` を取得していますということですrecord.h未定義の参照portaudio

#ifndef RECORD_H 
#define RECORD_H 
#include <iostream> 
#include "portaudio.h" 
class record 
{ 
public: 
    record(); 
    void example(); 
}; 

#endif // RECORD_H 

main.cppに:

#include <iostream> 
#include "record.h" 

using namespace std; 

int main() 
{ 
    record test; 
    test.example(); 

    cout << "Hello World!" << endl; 
    return 0; 
} 

Cmakelist:LIB/portaudioが存在しない場合 プロジェクト(オーディオ) cmake_minimum_required(バージョン3.2.2) の#include externalproject {portaudio}。 は(ExternalProject) ExternalProject_Add INCLUDE(project_portaudio GIT_REPOSITORY https://git.assembla.com/portaudio.git PREFIX libに/ portaudio UPDATE_COMMAND "" CONFIGURE_COMMANDを/ BUILD_IN_SOURCE 1 設定BUILD_COMMAND INSTALL_COMMANDのsudoはmake installを作る ) ExternalProject_Get_Property(project_portaudio BINARY_DIR) ExternalProject_Get_Property(project_portaudio SOURCE_DIR)

SET(portaudio_lib_dir "${BINARY_DIR}/lib/.libs") 
SET(portaudio_inc_dir "${SOURCE_DIR}/include") 


#IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") 
# SET(EXTRA_LIBS rt m asound pthread) 
#ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") 

#Add the files in the source list 
aux_source_directory(. SRC_LIST) 

#Add portaudio library 
ADD_LIBRARY(portaudio STATIC IMPORTED) 
SET_PROPERTY(TARGET portaudio PROPERTY IMPORTED_LOCATION "${portaudio_lib_dir}/libportaudio.a") 
add_executable(${PROJECT_NAME} ${SRC_LIST} ${portaudio_inc_dir}) 

#What to compile before target! 
add_dependencies(${PROJECT_NAME} project_portaudio) 

#What libraries to link to the target! 
TARGET_LINK_LIBRARIES(${PROJECT_NAME} portaudio) 
project(audio) 
cmake_minimum_required(VERSION 3.2.2) 
#include externalproject {portaudio} if lib/portaudio don't exist. 
INCLUDE(ExternalProject) 
ExternalProject_Add(project_portaudio 
    GIT_REPOSITORY  https://git.assembla.com/portaudio.git 
    PREFIX    lib/portaudio 
    UPDATE_COMMAND  "" 
    CONFIGURE_COMMAND <SOURCE_DIR>/configure 
    BUILD_IN_SOURCE  1 
    BUILD_COMMAND  make 
    INSTALL_COMMAND  sudo make install 
) 
ExternalProject_Get_Property(project_portaudio BINARY_DIR) 
ExternalProject_Get_Property(project_portaudio SOURCE_DIR) 

SET(portaudio_lib_dir "${BINARY_DIR}/lib/.libs") 
SET(portaudio_inc_dir "${SOURCE_DIR}/include") 


#IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") 
# SET(EXTRA_LIBS rt m asound pthread) 
#ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") 

#Add the files in the source list 
aux_source_directory(. SRC_LIST) 

#Add portaudio library 
ADD_LIBRARY(portaudio STATIC IMPORTED) 
SET_PROPERTY(TARGET portaudio PROPERTY IMPORTED_LOCATION "${portaudio_lib_dir}/libportaudio.a") 
add_executable(${PROJECT_NAME} ${SRC_LIST} ${portaudio_inc_dir}) 

#What to compile before target! 
add_dependencies(${PROJECT_NAME} project_portaudio) 

#What libraries to link to the target! 
TARGET_LINK_LIBRARIES(${PROJECT_NAME} portaudio) 

which code必要なファイルが存在し、CMakeListが追加されたので、賢明ではありません。だから問題は見えません。いくつかのことを変更しました

更新

、私は取得しています新しいエラーは次のとおりです。

lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `PaAlsaStream_WaitForFrames': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:3792: undefined reference to `pthread_testcancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `CallbackThreadFunc': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4197: undefined reference to `__pthread_register_cancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4202: undefined reference to `pthread_testcancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4240: undefined reference to `pthread_testcancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:4365: undefined reference to `__pthread_unregister_cancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_linux_alsa.o): In function `PaAlsa_LoadLibrary': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:380: undefined reference to `snd_pcm_open' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:381: undefined reference to `snd_pcm_close' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:382: undefined reference to `snd_pcm_nonblock' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:383: undefined reference to `snd_pcm_frames_to_bytes' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:384: undefined reference to `snd_pcm_prepare' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:385: undefined reference to `snd_pcm_start' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:386: undefined reference to `snd_pcm_resume' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:387: undefined reference to `snd_pcm_wait' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:388: undefined reference to `snd_pcm_state' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:389: undefined reference to `snd_pcm_avail_update' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:390: undefined reference to `snd_pcm_areas_silence' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:391: undefined reference to `snd_pcm_mmap_begin' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:392: undefined reference to `snd_pcm_mmap_commit' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:393: undefined reference to `snd_pcm_readi' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:394: undefined reference to `snd_pcm_readn' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:395: undefined reference to `snd_pcm_writei' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:396: undefined reference to `snd_pcm_writen' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:397: undefined reference to `snd_pcm_drain' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:398: undefined reference to `snd_pcm_recover' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:399: undefined reference to `snd_pcm_drop' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:400: undefined reference to `snd_pcm_area_copy' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:401: undefined reference to `snd_pcm_poll_descriptors' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:402: undefined reference to `snd_pcm_poll_descriptors_count' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:403: undefined reference to `snd_pcm_poll_descriptors_revents' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:404: undefined reference to `snd_pcm_format_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:405: undefined reference to `snd_pcm_link' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:406: undefined reference to `snd_pcm_delay' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:408: undefined reference to `snd_pcm_hw_params_sizeof' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:409: undefined reference to `snd_pcm_hw_params_malloc' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:410: undefined reference to `snd_pcm_hw_params_free' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:411: undefined reference to `snd_pcm_hw_params_any' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:412: undefined reference to `snd_pcm_hw_params_set_access' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:413: undefined reference to `snd_pcm_hw_params_set_format' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:414: undefined reference to `snd_pcm_hw_params_set_channels' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:416: undefined reference to `snd_pcm_hw_params_set_rate_near' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:417: undefined reference to `snd_pcm_hw_params_set_rate' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:418: undefined reference to `snd_pcm_hw_params_set_rate_resample' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:420: undefined reference to `snd_pcm_hw_params_set_buffer_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:421: undefined reference to `snd_pcm_hw_params_set_buffer_size_near' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:422: undefined reference to `snd_pcm_hw_params_set_buffer_size_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:424: undefined reference to `snd_pcm_hw_params_set_period_size_near' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:425: undefined reference to `snd_pcm_hw_params_set_periods_integer' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:426: undefined reference to `snd_pcm_hw_params_set_periods_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:428: undefined reference to `snd_pcm_hw_params_get_buffer_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:433: undefined reference to `snd_pcm_hw_params_get_channels_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:434: undefined reference to `snd_pcm_hw_params_get_channels_max' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:436: undefined reference to `snd_pcm_hw_params_test_period_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:437: undefined reference to `snd_pcm_hw_params_test_format' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:438: undefined reference to `snd_pcm_hw_params_test_access' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:439: undefined reference to `snd_pcm_hw_params_dump' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:440: undefined reference to `snd_pcm_hw_params' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:442: undefined reference to `snd_pcm_hw_params_get_periods_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:443: undefined reference to `snd_pcm_hw_params_get_periods_max' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:444: undefined reference to `snd_pcm_hw_params_set_period_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:445: undefined reference to `snd_pcm_hw_params_get_period_size_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:446: undefined reference to `snd_pcm_hw_params_get_period_size_max' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:447: undefined reference to `snd_pcm_hw_params_get_buffer_size_max' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:448: undefined reference to `snd_pcm_hw_params_get_rate_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:449: undefined reference to `snd_pcm_hw_params_get_rate_max' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:450: undefined reference to `snd_pcm_hw_params_get_rate_numden' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:452: undefined reference to `snd_pcm_sw_params_sizeof' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:453: undefined reference to `snd_pcm_sw_params_malloc' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:454: undefined reference to `snd_pcm_sw_params_current' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:455: undefined reference to `snd_pcm_sw_params_set_avail_min' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:456: undefined reference to `snd_pcm_sw_params' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:457: undefined reference to `snd_pcm_sw_params_free' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:458: undefined reference to `snd_pcm_sw_params_set_start_threshold' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:459: undefined reference to `snd_pcm_sw_params_set_stop_threshold' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:460: undefined reference to `snd_pcm_sw_params_get_boundary' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:461: undefined reference to `snd_pcm_sw_params_set_silence_threshold' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:462: undefined reference to `snd_pcm_sw_params_set_silence_size' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:463: undefined reference to `snd_pcm_sw_params_set_xfer_align' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:464: undefined reference to `snd_pcm_sw_params_set_tstamp_mode' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:466: undefined reference to `snd_pcm_info' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:467: undefined reference to `snd_pcm_info_sizeof' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:468: undefined reference to `snd_pcm_info_malloc' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:469: undefined reference to `snd_pcm_info_free' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:470: undefined reference to `snd_pcm_info_set_device' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:471: undefined reference to `snd_pcm_info_set_subdevice' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:472: undefined reference to `snd_pcm_info_set_stream' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:473: undefined reference to `snd_pcm_info_get_name' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:474: undefined reference to `snd_pcm_info_get_card' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:476: undefined reference to `snd_ctl_pcm_next_device' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:477: undefined reference to `snd_ctl_pcm_info' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:478: undefined reference to `snd_ctl_open' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:479: undefined reference to `snd_ctl_close' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:480: undefined reference to `snd_ctl_card_info_malloc' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:481: undefined reference to `snd_ctl_card_info_free' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:482: undefined reference to `snd_ctl_card_info' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:483: undefined reference to `snd_ctl_card_info_sizeof' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:484: undefined reference to `snd_ctl_card_info_get_name' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:486: undefined reference to `snd_config' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:487: undefined reference to `snd_config_update' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:488: undefined reference to `snd_config_search' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:489: undefined reference to `snd_config_iterator_entry' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:490: undefined reference to `snd_config_iterator_first' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:491: undefined reference to `snd_config_iterator_end' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:492: undefined reference to `snd_config_iterator_next' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:493: undefined reference to `snd_config_get_string' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:494: undefined reference to `snd_config_get_id' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:495: undefined reference to `snd_config_update_free_global' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:497: undefined reference to `snd_pcm_status' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:498: undefined reference to `snd_pcm_status_sizeof' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:499: undefined reference to `snd_pcm_status_get_tstamp' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:500: undefined reference to `snd_pcm_status_get_state' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:501: undefined reference to `snd_pcm_status_get_trigger_tstamp' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:502: undefined reference to `snd_pcm_status_get_delay' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:504: undefined reference to `snd_card_next' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:505: undefined reference to `snd_asoundlib_version' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:506: undefined reference to `snd_strerror' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/alsa/pa_linux_alsa.c:507: undefined reference to `snd_output_stdio_attach' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOSS_AudioThreadProc': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1620: undefined reference to `__pthread_register_cancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1641: undefined reference to `pthread_testcancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1676: undefined reference to `pthread_testcancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1759: undefined reference to `sem_post' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_WaitForFrames': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1336: undefined reference to `pthread_testcancel' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1370: undefined reference to `pthread_testcancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOSS_AudioThreadProc': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1770: undefined reference to `__pthread_unregister_cancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `StartStream': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:1813: undefined reference to `sem_wait' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_Terminate': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:920: undefined reference to `sem_destroy' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_oss.o): In function `PaOssStream_Initialize': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/hostapi/oss/pa_unix_oss.c:902: undefined reference to `sem_init' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUtil_StartThreading': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:184: undefined reference to `pthread_create' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUtil_CancelThreading': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:205: undefined reference to `pthread_join' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:203: undefined reference to `pthread_cancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUnixThread_Terminate': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:441: undefined reference to `pthread_join' 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:437: undefined reference to `pthread_cancel' 
lib/portaudio/src/project_portaudio/lib/.libs/libportaudio.a(pa_unix_util.o): In function `PaUnixThread_New': 
/home/lambda/soundcloud/audio/lib/portaudio/src/project_portaudio/src/os/unix/pa_unix_util.c:305: undefined reference to `pthread_create' 
collect2: error: ld returned 1 exit status 
make[2]: *** [audio] Error 1 
make[1]: *** [CMakeFiles/audio.dir/all] Error 2 
make: *** [all] Error 2 
+0

あなたがPortAudioのどのバージョンを使用していますか? 'Pa_CountDevices'は最新バージョンには存在しません。 – aschepler

+0

hmm ..興味深いことに、portaudio.hの私のバージョンは、その機能を持っています.. – Lamda

+0

私のportaudio.hのバージョンは、repo ...にあるものとは異なるようです。 – Lamda

答えて

0

あなたCMakeのスクリプトは、あなたをリンクすることを指示する、「target_link_libraries」行が含まれていないようですプロジェクトは、portaudioライブラリに対して実行可能です。 'add_dependencies'行は、portaudioが最初に構築されているかどうかを確認するだけで、実際にはそれとリンクしません。次のようなものを追加すること

試してみてください。

target_link_libraries(${PROJECT_NAME} portaudio) 
+0

どこに私をcmakelistに入れたいですか? – Lamda

+0

最後に追加すると、エラーメッセージの多くを生成します。.. – Lamda

+0

がhttps://pastebin.com/mGDfiHgUここでエラーメッセージが..です – Lamda