ALSA Lib 1.1.2编译错误

时间:2016-09-19 17:12:51

标签: c linux gcc audio libalsa

我正在尝试为基于linux-arm的处理器交叉编译ALSA Lib应用程序。我正在使用eclipse为我做构建。应用程序的构建阶段是成功的,但是当gcc链接器尝试完成时我得到错误。

我收到以下错误

  

建立目标:声音   调用:交叉GCC链接器   arm-linux-gnueabihf-gcc -L / proc / asound -L / srv / nfs / rootfs / usr / lib -Wl,-rpath-link,/ srv / nfs / rootfs / usr / lib -L ​​/ srv / nfs / rootfs / lib -Wl,-rpath-link,/ srv / nfs / rootfs / lib -o" sound" ./play.o
  ./play.o:在函数main': /home/neonws/sound/Debug/../play.c:13: undefined reference to snd_pcm_open'   makefile:29:目标'声音的配方'失败   /home/neonws/sound/Debug/../play.c:14:对snd_strerror' /home/neonws/sound/Debug/../play.c:20: undefined reference to snd_pcm_hw_params_malloc'的未定义引用   /home/neonws/sound/Debug/../play.c:21:对snd_strerror' /home/neonws/sound/Debug/../play.c:26: undefined reference to snd_pcm_hw_params_any'的未定义引用   /home/neonws/sound/Debug/../play.c:27:对snd_strerror' /home/neonws/sound/Debug/../play.c:32: undefined reference to snd_pcm_hw_params_set_access'的未定义引用   /home/neonws/sound/Debug/../play.c:33:对snd_strerror' /home/neonws/sound/Debug/../play.c:38: undefined reference to snd_pcm_hw_params_set_format'的未定义引用   /home/neonws/sound/Debug/../play.c:39:对snd_strerror' /home/neonws/sound/Debug/../play.c:44: undefined reference to snd_pcm_hw_params_set_rate_near'的未定义引用   /home/neonws/sound/Debug/../play.c:45:对snd_strerror' /home/neonws/sound/Debug/../play.c:50: undefined reference to snd_pcm_hw_params_set_channels'的未定义引用   /home/neonws/sound/Debug/../play.c:51:对snd_strerror' /home/neonws/sound/Debug/../play.c:56: undefined reference to snd_pcm_hw_params'的未定义引用   /home/neonws/sound/Debug/../play.c:57:未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:62: undefined reference to snd_pcm_hw_params_free'   /home/neonws/sound/Debug/../play.c:64:对snd_pcm_prepare' /home/neonws/sound/Debug/../play.c:65: undefined reference to snd_strerror'的未定义引用   /home/neonws/sound/Debug/../play.c:71:对snd_pcm_writei' /home/neonws/sound/Debug/../play.c:72: undefined reference to snd_strerror'的未定义引用   /home/neonws/sound/Debug/../play.c:78:未定义对`snd_pcm_close'的引用   collect2:错误:ld返回1退出状态   make:*** [声音]错误1

11:15:58建成(花了75毫秒)

我正在使用来自ASLA-LIB api的Sample Playback Program

我想知道导致链接器失败的原因是什么?

1 个答案:

答案 0 :(得分:1)

您错过了asound库链接,将-lasound添加到链接标记中(请参阅this question,告知在Eclipse中正确执行此操作的位置)。并且可能删除-L/proc/asound,我认为你没有你的库。