2

目前,我正在为 Raspberry Pi 修改 C 应用程序。我使用以下命令构建应用程序:

make

现在我想使用libconfig库。我有以下问题

pi@raspberrypi ~/yyyyy $ make
make --no-print-directory all-am
  CC       tools/xxxxx.o
  CCLD     tools/xxxxx
tools/xxxxx.c:2434: undefined reference to `config_read_file'
tools/xxxxx.c:2441: undefined reference to `config_lookup_string'
tools/xxxxx.c:2446: undefined reference to `config_destroy'
tools/xxxxx.c:2436: undefined reference to `config_destroy'

libconfig 手册中,他们说:

要与库链接,请将“-lconfig”指定为链接器的参数。

如何与make命令链接?

4

1 回答 1

1

在不研究 bluez 的构建系统的情况下,我可以提供简单的方法 - 使用环境变量。

# export CPPFLAGS='-I/home/oleksandr/software/libconfig/include'
# export LDFLAGS='-L/home/oleksandr/software/libconfig/lib/'
# ./configure

这应该会生成您的 Makefile,您可以使用它来编译 bluez 并将其与 libconfig 链接。

于 2015-10-16T09:55:16.887 回答