Search code examples
sublimetext3swi-prolog

Using Sublime text 3 to build SWI prolog projects


Can I build with SWI prolog in sublime text on windows?

What i have tried: I used package control to install the Prolog package here: https://github.com/alnkpa/sublimeprolog I have SWI prolog installed but I cannot build. Maybe the file path or name to swi is wrong?

Thanks in advance!

/JC

I get this error:

    [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-----------------------------------------------------------------------

According the suggestions by Danilo I made sure that i have a saved file with a main function in it. But i still get the same error. Any ideas?

[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]

Solution

  • that's happening because the build file is not well seated you need to install (PackageResourceviewer) from the package manager then: 1- from tool tab select command palette or (ctrl+shift+p) 2- search for : PackageResourceviewer: open resource and select it 3- search for your package in our case prolog and select it 4- select prolog.sublime-build 5-

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

    change swipl to the main directory of the swiple compiler you need to add the main:- at the beginning

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