Sublimetext3 使用Sublime text 3构建SWI prolog项目

Sublimetext3 使用Sublime text 3构建SWI prolog项目,sublimetext3,swi-prolog,Sublimetext3,Swi Prolog,我可以在windows上使用SWI prolog以升华文本进行构建吗 我所尝试的: 我使用包控制在此处安装Prolog包: 我已安装SWI prolog,但无法生成。可能swi的文件路径或名称错误 提前谢谢 /JC 我得到这个错误: [WinError 2] File not found (Det går inte att hitta filen) [cmd: ['swipl', '-f', '', '-t', 'main', '--quiet']] [dir: C:\P

我可以在windows上使用SWI prolog以升华文本进行构建吗

我所尝试的: 我使用包控制在此处安装Prolog包: 我已安装SWI prolog,但无法生成。可能swi的文件路径或名称错误

提前谢谢

/JC

我得到这个错误:

    [WinError 2] File not found (Det går inte att hitta filen)
    [cmd: ['swipl', '-f', '', '-t', 'main', '--quiet']]
    [dir: C:\Program Files\Sublime Text 3]
    [path: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\MATLAB\R2014b\runtime\win64;C:\Program Files\MATLAB\R2014b\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft Data Protection Manager\DPM\bin\VDDK\bin\]
    [Finished]
更新-----------------------------------------------------------------------

根据Danilo的建议,我确保保存了一个带有主功能的文件。但我还是犯了同样的错误。有什么想法吗

[WinError 2] File not found
[cmd: ['swipl', '-f', 'testa.pl', '-t', 'main', '--quiet']]
[dir: C:\Users\psyk-jcr\Documents\Forskning\Prolog meta-analys\Kod]
[path: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\MATLAB\R2014b\runtime\win64;C:\Program Files\MATLAB\R2014b\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft Data Protection Manager\DPM\bin\VDDK\bin\]
[Finished]

您似乎没有将程序保存在文件中。看看这里

[cmd:['swipl'、'-f'、'、'-t'、'main'、'-quiet']

您的
sublime
构建系统准备与子句
main/0
统一。所以你的程序入口点应该是

main :-
    write("hello, world!\n").

之所以会出现这种情况,是因为生成文件位置不正确。您需要从软件包管理器安装(PackageResourceviewer),然后: 1-从工具选项卡选择命令选项板或(ctrl+shift+p) 2-搜索:PackageResourceviewer:打开资源并选择它 3-在我们的案例序言中搜索您的包并选择它 4-选择prolog.sublime-build 5-

将swipl更改为swiple编译器的主目录 您需要在开头添加main:

main:-
    likes("Name", "Another").
    likes("Name","Another") :- likes("Ahmed", "Another").

我终于设法解决了我的问题。根据@Ahmed Elkady的建议,我用swipl的路径更新了我的prolog.sublime-build。就我而言:

{
    "cmd": ["C:\\Program Files\\swipl\\bin\\swipl", "-f", "$file_name", "-t", "main", "--quiet"],
    "working_dir": "$file_path",
    "file_regex": "^Warning: (.+):([0-9]+)",
    "selector": "source.prolog"
}

谢谢你的建议,丹尼洛。但即使在保存文件时,我也会遇到同样的错误:谢谢Danilo!但是,即使我确保保存文件并使用main函数(如我更新的帖子中所示),我仍然会遇到相同的错误。请在控制台上尝试相同的命令
swipl-f tesla.pl-t main--quiet
。如果出现错误,则可能是到
swipl
的路由不在
%PATH%
环境变量中。如果不是,错误可能来自
sublime
。您好!谢谢你的回复。我按照您的指示更改了文件,所以现在看起来是这样的:`{“cmd”:[“C:\Program Files(x86)\swipl”、“-f”、“$file\u name”、“-t”、“main”、“--quiet”]、“working\u dir”:“$file\u path”、“file\u regex”:“^Warning:(.+):([0-9]+),“selector”:“source.prolog”}。但是它仍然不起作用(当我尝试构建时,什么也没有发生)。我的文件中有一个主谓词。
{
    "cmd": ["C:\\Program Files\\swipl\\bin\\swipl", "-f", "$file_name", "-t", "main", "--quiet"],
    "working_dir": "$file_path",
    "file_regex": "^Warning: (.+):([0-9]+)",
    "selector": "source.prolog"
}