【发布时间】:2022-11-16 15:02:53
【问题描述】:
我已经用 asdf 系统创建了几次可执行文件。我知道还有其他方法可以做到这一点,但我想弄清楚为什么这一次不起作用。
我有一个剪刀石头布游戏。
口齿不清文件:
(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
包.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")
生成文件:
build:
sbcl \
--eval '(load "rps.asd")' \
--eval '(ql:quickload "rps")' \
--eval '(asdf:make :rps)' \
--eval '(quit)'
错误信息:
The function rps:main is an undefined
我遵循了与我之前创建的包完全相同的过程。由于某种原因,这次无法识别 main。为什么?
【问题讨论】:
-
在实际定义函数
main之前,lisp文件中是否有对(in-package "RPS")的调用?否则,您实际上定义的是cl:main,而不是rfs:main -
默认不是 CL,但可能是 CL-USER ... Common Lisp 包没有 MAIN 符号。
-
main 是我在 rps.lisp @RainerJoswig 中定义的函数
-
@Numbra 我相信先有鸡还是先有蛋...如果我将
(in-package "rps")添加到我的rps.lisp,那么当我 (ql:quickload "rps") 时,我会收到“RPS”不是包的错误.
标签: makefile package common-lisp sbcl