程序通过引用主函数并传递任何参数在 drRacket 中运行。如何从命令行或单击 .exe 文件执行此操作?主要功能如下:
(define (worm-main ct)
(big-bang (make-wormState (init-worm INIT-WORM-SEGS START-POSN) "r" (food-create (make-posn 99999 99999)))
[to-draw render]
[on-key navigate]
[on-tick move ct]
[stop-when end-chk? final-scene]))
我这样称呼 worm-main :- (worm-main 0.2)
最佳答案
根据您所写的内容,您似乎是从 DrRacket 的“Racket”菜单中的“创建可执行文件”项创建了可执行文件。您可以通过输入 (worm-main 0.2)
从交互区域调用主定义。
您的可执行文件无法运行,因为您尚未在定义窗口中添加对 main 函数的调用。事实上,可执行文件只包含创建可执行文件之前的文件。
在创建可执行文件之前,您必须将调用 (worm-main 0.2)
添加到定义窗口。
关于racket - 如何从 Windows 运行已编译的 Racket 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35564482/