未捕获的异常:错误(exist_error(过程,不是/ 1),play / 0)

时间:2017-04-20 18:32:30

标签: prolog

我试图在prolog中理解这个code的tic tac toe。 我能够在gprolog中编译代码,

| ?- ['/**/**/**/tictactoe.pl'].
    compiling /**/**/**/tictactoe.pl for byte code...
    /**/**/**/tictactoe.pl compiled, 142 lines read - 11825 bytes written, 12 ms
    (2 ms) yes

但是当我执行play时,我收到以下错误:

| ?- play.
uncaught exception: error(existence_error(procedure,not/1),play/0)

正如您在代码的最后一行中所看到的,play定义如下:

play :-not(clear), repeat, getmove, makemove, printboard, done.

同样的代码在SWI-prolog

中运行得非常好

当我尝试使用以下两个命令之一在终端中运行prolog文件时

gplc --no-top-level tictactoe.pl

gplc  tictactoe.pl

我收到以下错误:

Undefined symbols for architecture x86_64:
  "predicate(assert/1)", referenced from:
      predicate(getmove/0) in gplcMtKfGg.o
      predicate(makemove/0) in gplcMtKfGg.o
  "predicate(not/1)", referenced from:
      predicate(empty/1) in gplcMtKfGg.o
      predicate(different/2) in gplcMtKfGg.o
      predicate(play/0) in gplcMtKfGg.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
compilation failed

1 个答案:

答案 0 :(得分:1)

assert代替asserta解决了这个问题。

相关问题