我可以在windows上的sublime文本中使用SWI prolog构建吗?
我尝试过: 我在这里使用包控制来安装Prolog包: https://github.com/alnkpa/sublimeprolog 我安装了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]
UPDATE ---------------------------------------------- -------------------------
根据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]
答案 0 :(得分:3)
之所以这样,是因为构建文件的位置不好,您需要从程序包管理器中安装(PackageResourceviewer),然后: 1-从工具选项卡中选择命令面板或(ctrl + shift + p) 2-搜索:PackageResourceviewer:打开资源并选择它 3-在我们的案例序言中搜索您的包裹并选择它 4-选择prolog.sublime-build 5-
{
"cmd": ["swipl", "-f", "$file_name", "-t", "main", "--quiet"],
"working_dir": "$file_path",
"file_regex": "^Warning: (.+):([0-9]+)",
"selector": "source.prolog"
}
将swipl更改为swiple编译器的主目录 您需要添加main:-开头
main:-
likes("Name", "Another").
likes("Name","Another") :- likes("Ahmed", "Another").
答案 1 :(得分:1)
好的,好像是你没有将程序保存在文件中。看看这里
[cmd:['swipl',' - f','',' - t','main',' - quiet']]
您的sublime
构建系统已准备好与main/0
条款统一。所以你的程序入口点应该是
main :-
write("hello, world!\n").
答案 2 :(得分:0)
I finally managed to solve my problem. As suggested by @Ahmed Elkady I updated my prolog.sublime-build with the path to swipl. In my case:
{
"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"
}