I wasted a whole day on this and can't find a solution. As Google doesn't supply any other questions like this, I'm sure that I must be doing something wrong.
I have a fresh full install of swi-prolog 8.2.3.1 on windows 10. I made sure the graphic options where selected. There is an xpce folder in the main swipl folder. When I try to load the xpce lib into prolog I get the following error:
?- [library('pce')].
ERROR: source_sink `library(pce)' does not exist
ERROR: In:
ERROR: [20] throw(error(existence_error(source_sink,...),_8462))
ERROR: [16] '$resolve_source_path'(library(pce),_8494,[expand(true)]) at c:/program files/swipl/boot/init.pl:2315
ERROR: [15] '$load_file'(library(pce),user,[expand(true)]) at c:/program files/swipl/boot/init.pl:2289
ERROR: [9] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
I tried to consult a file with :- use_module(library(pce)).
in it and get the same error. I have no idea how to proceed. It works just fine with ubunutu on wsl on the same machine, but without any graphical interface, it does only help to make sure the commands are correct.
Further information on the outcome of @david-tonhofer's solution:
I have this file in "C:\Program Files\swipl\xpce\prolog\lib". So I tried the folliwing:
?- file_search_path(library,X).
X = app_config(lib) ;
X = swi(library) ;
X = swi(library/clp) ;
false.
2 ?- assertz(file_search_path(library,pce('prolog/lib'))).
true.
3 ?- file_search_path(library,X).
X = app_config(lib) ;
X = swi(library) ;
X = swi(library/clp) ;
X = pce('prolog/lib').
4 ?- file_search_path(library,pce('prolog/lib')).
true.
5 ?- file_search_path(pce,X).
false.
6 ?- assertz(file_search_path(pce,'C:/Program Files/swipl/xpce/')).
true.
7 ?- file_search_path(pce,X).
X = 'C:/Program Files/swipl/xpce/'.
8 ?- use_module(library(pce)).
true.
There should be a file
./swiplexe_8.3.14/lib/swipl/xpce/prolog/lib/pce.pl
in your installation directory.
Calling
?- use_module(library(pce)).
on the toplevel of Prolog or
:- use_module(library(pce)).
instructs it to load pce.pl
found in the library path.
It could be your library path is incomplete....
Consult your search path by issuing
?- file_search_path(library,X).
X = app_config(lib) ;
X = swi(library) ;
X = swi(library/clp) ;
X = pce('prolog/lib'). <--- should be there
Extend your search path by issuing
?- assertz(file_search_path(library,SOME_PATH_AS_STRING_OR_ATOM)).
However, the fact
file_search_path(library,pce('prolog/lib')).
indicates a two-level lookup.
We also need to ascertain that pce
is set:
I have this:
?- file_search_path(pce,X).
X = '/usr/local/logic/swiplexe_8.3.14/lib/swipl/xpce'.
So it may be necessary to issue
?- assertz(file_search_path(pce,DIR_OF_XPCE_AS_STRING_OR_ATOM)).