3

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

我收到以下错误

构建目标:声音调用:Cross GCC Linker 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 tosnd_pcm_open' 生成文件中: 29:目标“声音”的配方失败 /home/neonws/sound/Debug/../play.c:14:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:20: undefined reference tosnd_pcm_hw_params_malloc 的引用'/home/neonws/sound/Debug/../play.c:21:对snd_strerror' /home/neonws/sound/Debug/../play.c:26: undefined reference tosnd_pcm_hw_params_any' 的未定义引用'/home/neonws/sound/Debug/../play.c:27: 对 snd_pcm_hw_params_set_access' 的未定义引用'/home/neonws/sound/Debug/../play.c:33: 对snd_pcm_hw_params_set_formatsnd_strerror' /home/neonws/sound/Debug/../play.c:32: undefined reference to的未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:38: undefined reference to' /home/neonws/sound/Debug/../play.c:39:未定义的引用snd_strerror' /home/neonws/sound/Debug/../play.c:44: undefined reference tosnd_pcm_hw_params_set_rate_near' /home/neonws/sound/Debug/../play.c:45: 未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:50: undefined reference tosnd_pcm_hw_params_set_channels' /home/neonws/sound/Debug/../play.c:51: 未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:56: undefined reference tosnd_pcm_hw_params' /home /neonws/sound/Debug/../play.c:57: 未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:62: undefined reference tosnd_pcm_hw_params_free' /home/neonws/sound/Debug/../play.c:64: 未定义引用snd_pcm_prepare' /home/neonws/sound/Debug/../play.c:65: undefined reference tosnd_strerror' /home/neonws/sound /Debug/../play.c:71:未定义引用snd_pcm_writei' /home/neonws/sound/Debug/../play.c:72: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:78:未定义引用 `snd_pcm_close' collect2:错误:ld 返回 1 个退出状态make: *** [声音] 错误 1

11:15:58 构建完成(耗时 75 毫秒)

我正在使用来自 ASLA-LIB api 的示例播放程序。

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

4

1 回答 1

3

您缺少asound库链接,添加-lasound到您的链接标志(请参阅这个问题,它告诉在 Eclipse 中正确执行该操作的位置)。并且可能 remove -L/proc/asound,我不认为你在那里有你的图书馆。

于 2016-09-19T17:41:04.680 回答