I am using SWI Prolog for a mathematical logic book and the book provided source code for some of the algorithms in Prolog. The problem is that when I try to load a file, the interpreter just prompt something like:
load_files/2: No permission to load source `**' (Non-module file already loaded into module **; trying to load into io)
I looked into the source code and found that most of the files start with:
:- module(**,[***]).
followed by
user:file_search_path(common,'../common').
:- ensure_loaded(ops).
:- ensure_loaded(def).
and it seems that calling ensure_loaded twice with the same file caused the error, and if some of the predicates in the already loaded file (ops.pl for example) will not be defined in the file that tried to load it for the second time.
I tried changing ensure_loaded to use_module and consult but didn't work.
ensure_loaded
withreconsult
, but the error is still there. – Vimos