2012-04-12 36 views
3

我试图在Windows中创建一个从顶层保存的状态保存的状态,但我不断收到此错误:创建在SWI-Prolog的

1 ?- qsave_program('U:/boo64.prc'). 
% library(broadcast) compiled into broadcast 0.00 sec, 7,504 bytes 
% library(debug) compiled into prolog_debug 0.00 sec, 21,544 bytes 
% library(option) compiled into swi_option 0.00 sec, 14,416 bytes 
% library(arithmetic) compiled into arithmetic 0.00 sec, 33,872 bytes 
% library(settings) compiled into settings 0.00 sec, 120,152 bytes 
% c:/program files/swi-prolog/library/listing compiled into prolog_listing 0.00 sec, 180,936 bytes 
% library(occurs) compiled into occurs 0.00 sec, 5,144 bytes 
% library(prolog_clause) compiled into prolog_clause 0.00 sec, 61,544 bytes 
% c:/program files/swi-prolog/library/prolog_stack compiled into prolog_stack 0.00 sec, 77,320 bytes 
ERROR: '$mark_executable'/1: file `U:/boo64.prc' does not exist (No such file or directory) 
2 ?- 

我想这应该这样做。为什么它甚至试图调用'mark_executable'?我只需要一个可以从我的嵌入式C/C++应用程序加载的资源文件。

任何人都可以帮忙吗?

+0

您确定您有权访问驱动器U吗? – gusbro 2012-04-12 15:21:43

+0

无论我使用哪个驱动器/文件名/扩展名,我总是得到这个.. – aLu 2012-04-12 15:24:25

+0

好吧,这很奇怪。我已经用我的SWI 5.10.4(windows)在这里试过了,它工作正常。我只设法得到错误,如果我使用无效的文件名。 – gusbro 2012-04-12 15:41:05

回答

3

qsave_program的SWI-Prolog文档简洁且难以遵循,但是 start here。最后两部分,创建保存状态使用-c命令行选项进行编译至少会为您提供一个尝试的示例。

我认为这里的问题是,使用单参数版本qsave_program强制程序状态不仅保存为资源,而且保存为机器相关可执行文件(Prolog仿真器)末尾的资源。 Windows上的这种文件需要.exe扩展名,但您试图强制扩展.prc

从示例中,我会尝试使用原子boo64作为您的文件参数。如果您想从程序保存状态中删除模拟器,或者检查该资源,请查看this page底部链接的部分。

+0

thx,这个acacally做的窍门: “swipl --stand_alone = false -o boot64.prc -c test.pl” 我只是想知道为什么产生的文件是269KB,而原始文件是113KB(在我的test.pl中只有2个短testfacts) – aLu 2012-04-13 14:41:02

+0

其中一个* Options *参数('qsave_program')承诺给你一个人类可读的跟踪保存程序的内容。我认为它的'map(+ File)'其中* File *是放置轨迹的文件名。当你只关注你的test.pl文件时,你可能会想到一些库代码或其他状态信息。 – hardmath 2012-04-13 15:12:12