2015-10-16 28 views
2

目前,我正在修改Raspberry Pi的C應用程序。 我建立應用程序使用此命令:如何鏈接樹莓派應用程序的libconfig庫

make 

現在我想用libconfig庫。 我有這樣的問題,下面

[email protected] ~/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 manual他們說:

爲了與庫鏈接,指定「-lconfig」作爲參數傳遞給 連接。

我該如何鏈接make命令?

+1

向我們展示您的Makefile –

+1

以下是一個示例:http://stackoverflow.com/questions/6451342/library-path-in-makefiles –

+0

我正在編輯bluez應用程序。 http://www.bluez.org/download/。它的make文件太大,無法發佈到stackoverflow –

回答

1

沒有看看bluez的構建系統,我可以提供簡單的方法 - 使用環境變量。

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

這應該會生成Makefile,您可以使用它來編譯bluez並使用libconfig將其鏈接起來。

+0

我通過安裝libconfig-dev:sudo apt-get install libconfig-dev。然後我運行:dpkg -L libconfig-dev。但是我找不到/ include和/ lib /文件夾 –

+0

你有什麼想法嗎? –

+1

@ZuzooVn提取包並查看文件的安裝位置;或者直接搜索:find/-iname libconfig \ * –