Prolog existence_error procedure in basic example

The error message tells you that Prolog expects a predicate comes_after/0, but none is found. Further, this problem arises when being called from a predicate does_come_after/0. Now, your definitions all use arity 2. Thus comes_after/2 and does_come_after/2. So what the system expects cannot happen.

And if it does, this must be related to your installation. You have 1.4.5 which is the most recent version, 1.4.4 the still current stable.

It is thus possible that you have another, older, system installed which interferes by providing an incompatible pl2wam compiler. To verify this, say which pl2wam or pl2wam --version.

In particular, versions from 1.3 or even 1.2 may produce such results. There is no version checking for this in GNU.

To ensure that I get always the right version, I say:

 export PATH=/opt/gupu/gprolog-1.4.5/bin:${PATH}

Unfortunately, this is the problem with version 1.4.5.

Instead of downgrading, fortunately there is a trick that you can do:

Instead of using consult(file_name) inside gprolog, you can run this command on your terminal (outside gprolog)

    gplc file_name.pl

it will output an executable that you can run by

    ./file_name

it will solve your existence error problem.