/ usr/bin/ld:错误:找不到-lecl

nrz*_*nrz 0 c gcc compiler-errors common-lisp ecl

我正在尝试编译一个嵌入ECL的C程序示例,其中包含对C函数的回调. github.我已经安装了ECL(嵌入式的Common Lisp)通过克隆ECL回购git clone git://git.code.sf.net/p/ecls/ecl ecl,然后$ make# make install,并安装似乎正常,至少ECL开发人员指南:2.6编译器例子编译的罚款.

当我尝试编译ecldemo.c时,gcc ecldemo.c -lecl我收到以下错误:

/usr/bin/ld: error: cannot find -lecl
/tmp/ccRk8Q48.o:ecldemo.c:function foo: error: undefined reference to 'ecl_make_integer'
/tmp/ccRk8Q48.o:ecldemo.c:function bar: error: undefined reference to 'ecl_make_integer'
/tmp/ccRk8Q48.o:ecldemo.c:function ecl_call: error: undefined reference to 'ecl_make_simple_base_string'
/tmp/ccRk8Q48.o:ecldemo.c:function ecl_call: error: undefined reference to 'si_string_to_object'
/tmp/ccRk8Q48.o:ecldemo.c:function ecl_call: error: undefined reference to 'si_safe_eval'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'cl_boot'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'cl_shutdown'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'ecl_make_simple_base_string'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'si_string_to_object'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'ecl_def_c_function'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'ecl_make_simple_base_string'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'si_string_to_object'
/tmp/ccRk8Q48.o:ecldemo.c:function init: error: undefined reference to 'ecl_def_c_function'
/tmp/ccRk8Q48.o:ecldemo.c:function main: error: undefined reference to 'ecl_make_simple_base_string'
/tmp/ccRk8Q48.o:ecldemo.c:function main: error: undefined reference to 'si_string_to_object'
/tmp/ccRk8Q48.o:ecldemo.c:function main: error: undefined reference to 'si_safe_eval'
/tmp/ccRk8Q48.o:ecldemo.c:function main: error: undefined reference to 'cl_print'
/tmp/ccRk8Q48.o:ecldemo.c:function main: error: undefined reference to 'cl_equal'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我想知道这个错误行:

/usr/bin/ld: error: cannot find -lecl
Run Code Online (Sandbox Code Playgroud)

在我看来,gcc不知何故解释-lecl为源文件,而不是作为选项-l library(搜索名为库library)的选项.在-lecl(gcc ecldemo.c -l ecl)之间留一个空格没有帮助,输出是相同的(cannot find -lecl).

由于ecl.h位于/usr/local/include/ecl/ecldemo.c它附带的#include "ecl/ecl.h",我尝试添加一个图书馆目录中-L选择:

gcc -L /usr/local/include/ecl ecldemo.c -l ecl

......但无济于事,同样的错误usr/bin/ld: error: cannot find -lecl仍然存在.

任何可能导致此错误的想法以及如何解决这个问题?

Dav*_*rtz 7

你的-L选择是错误的.你需要告诉它在哪里找到,而不是在哪里找到头文件.图书馆是最有可能被称为libecl.solibecl.a或类似的东西.