Dan*_*mon 6 c lisp compiler-errors common-lisp ecl
我试图使用ECL创建一个.o文件,目的是使用其编译为C的功能,但是在尝试按文档列表构建程序时收到错误消息。
我在跑步:
(c:build-program "CompiledFile" "hello.lisp")
Run Code Online (Sandbox Code Playgroud)
收到错误:
Debugger received error of type: SIMPLE-ERROR
Cannot find the external symbol BUILD-PROGRAM in #<"C" package>.
Error flushed.
>> "CompiledFile"
>> "hello.lisp"
>> ;;; Warning: Ignoring an unmatched right parenthesis.
Run Code Online (Sandbox Code Playgroud)
hello.lisp的内容如下:
(defun say-hello ()
(print "Hello, world"))
(say-hello)
(terpri)
(quit)
Run Code Online (Sandbox Code Playgroud)
我正在这里https://common-lisp.net/project/ecl/static/manual/ch34s03.html找到的文档,其功能定义为:
c:build-program {image-name &key lisp-files ld-flags prologue-code epilogue-code}
根据https://ecls-list.narkive.com/xACoJUbf/c-build-program-and-eval,默认情况下未加载编译器,您需要使用
(require 'cmp)
Run Code Online (Sandbox Code Playgroud)
第一。
我不确定手册中为什么没有提到。