Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.14-41-g41ac4a569)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- gtrace.
% The graphical front-end will be used for subsequent tracing
true.
[trace] ?- print_term([a,b,c],[]).
I realised what the problem is (I think). I use Visual Studio Code, and have the SWI-Prolog extension. To run code, I type swipl in the VS terminal, and then call my predicates as I would if running the SWI-Prolog app.
If I run the installed SWI-Prolog app (where I get the interface) then indeed gtrace works fine. It’s only when I try it in the VS terminal that it doesn’t work.
Any idea how I run it from the VS terminal?
For the record, I’m running version 9.0.4 on Win11, and did do a full installation.
Actually, this might be possible these days. In the past you could not run a GUI from the commandline swipl.exe as this requires both the Windows message loop and synchronous read from the console. Since quite some years though, the IDE tools run in their own thread that (thus) also runs the message loop. So, you might be able to do
It works if you follow Jan’s suggestion. I also use VS Code and I found it almost miracolous when, launching a prolog file, XQuartz started (on MacOS). Although I know there’s nothing miracolous (in the end if it works from the Terminal why shouldn’t it work from the VS terminal…)
Thanks, but I get a message that swipl.rc doesn’t exist. Is this something that I should have, in which case where would I find it, or is it something I need to add, in which case what is it?
Probably should be [swi('swipl-win.rc')] on Windows. On MacOS both should work, but I think this work-around should not be needed because swipl can run graphics.
Computers themselves are all about solving problems you never knew you had, and in fact probably didn’t have until you started trying to solve them with a computer!
There’s a famous (sort-of) joke that went around years ago along the lines of “Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems”
I reckon you could substitute just about anything computer-related for “regular expressions” there
P.S. If you’re really bored, you can read a long and detailed background to that quote here.