c - ALSA Lib 1.1.2 编译错误

标签 c linux gcc audio libalsa

我正在尝试为基于 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 tosnd_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 tosnd_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 tosnd_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 tosnd_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 tosnd_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 tosnd_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 tosnd_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 tosnd_pcm_hw_params' /home/neonws/sound/Debug/../play.c:57: undefined reference to snd_strerror' /home/neonws/sound/Debug/../play.c:62: undefined reference tosnd_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 tosnd_strerror' /home/neonws/sound/Debug/../play.c:71: undefined reference to snd_pcm_writei' /home/neonws/sound/Debug/../play.c:72: undefined reference tosnd_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/

相关文章:

c - block 错误的openmp

java - 可下载应用程序中的不同语言

linux - 在 Windows Bash 上执行程序?

c++ - 使用 gcc 5.1 未定义 OpenCV 符号

c - 连续多次调用 sizeof()

c - while循环结束时n++和++n的区别? (美国标准 C)

c++ - C 与 C++ 中的 Pthread 之间的差异

c - fread 从 Linux 磁盘读取扇区时返回 0

linux - 在大文件中按分隔符拆分行

c++ - XCode 4 中有哪些版本的 gcc、llvm 和 clang?