gpt4 book ai didi

c - ALSA Lib 1.1.2 编译错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:43:56 28 4
gpt4 key购买 nike

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

我得到以下错误

Building target: sound Invoking: 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: In function main':
/home/neonws/sound/Debug/../play.c:13: undefined reference to
snd_pcm_open' makefile:29: recipe for target 'sound' failed /home/neonws/sound/Debug/../play.c:14: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:20: undefined reference to
snd_pcm_hw_params_malloc' /home/neonws/sound/Debug/../play.c:21: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:26: undefined reference to
snd_pcm_hw_params_any' /home/neonws/sound/Debug/../play.c:27: undefined reference to 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: undefined reference to 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: undefined reference to 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: undefined reference to 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: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:56: undefined reference to
snd_pcm_hw_params' /home/neonws/sound/Debug/../play.c:57: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:62: undefined reference to
snd_pcm_hw_params_free' /home/neonws/sound/Debug/../play.c:64: undefined reference to snd_pcm_prepare'
/home/neonws/sound/Debug/../play.c:65: undefined reference to
snd_strerror' /home/neonws/sound/Debug/../play.c:71: undefined reference to snd_pcm_writei'
/home/neonws/sound/Debug/../play.c:72: undefined reference to
snd_strerror' /home/neonws/sound/Debug/../play.c:78: undefined reference to `snd_pcm_close' collect2: error: ld returned 1 exit status make: *** [sound] Error 1

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

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

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

最佳答案

您缺少一个asound 库链接,将-lasound 添加到您的链接标志中(请参阅this question,它告诉您在Eclipse 中的何处正确执行此操作)。并且可能删除 -L/proc/asound,我不认为你在那里有你的图书馆。

关于c - ALSA Lib 1.1.2 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39578589/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com