我已经用asdf系统创建了几次可执行文件。我知道还有其他方法可以做到这一点,但我想弄清楚为什么这次不起作用。
我有一个石头剪刀布游戏。
lisp文件:(defun main ()
(let* ((x (y-or-n-p (format t "Is there two players? [Y/N]"))))
(if (equal x t)
(rps-game2)
(rps-game))))
... other stuff
package.lisp:
(defpackage #:rps
(:use #:cl)
(:export main))
rps.asd
(asdf:defsystem #:rps
:components ((:file "package")
(:file "rps"))
:build-operation "program-op"
:build-pathname "launch"
:entry-point "rps:main")
makefile:
build:
sbcl
--eval '(load "rps.asd")'
--eval '(ql:quickload "rps")'
--eval '(asdf:make :rps)'
--eval '(quit)'
错误信息:
The function rps:main is an undefined
我遵循与之前创建的包完全相同的过程。由于某种原因,这次main没有被识别。为什么?
我发现了以下问题:
- 在我的
rps.asd
中我添加了serial t
。我相信这告诉lisp按顺序编译文件。因此首先编译包,然后是rps文件。 - 我将
(in-package #:rps)
添加到rps中。lisp文件。(感谢@Numbra)