这是我的Makefile
CC = ocamlc
LIBES = str.cma
CFLAGS = -g -c
.PHONY : clean
dpll:
-rm -f dpll
$(CC) $(CFLAGS) dpll.ml
$(CC) -o dpll $(LIBES) dpll.cmo
make clean
test:
./dpll input.cnf
clean:
rm -f *.cmi *.cmo
和我的OCaml文件是这样的(dpll部分)。
let dpll_SAT =
try
let cnf = read_cnf Sys.argv.(1) in
let state = create_state [] cnf in
let (result, ass) = dpll state in
match result with
|false -> print_string "the cnf clauses are not satisfiable\n"
|_-> print_string "The cnf clauses are satisfiable and a model is as follows:\n";
print_assignment ass;;
with
|x ->
print_endline ("Backtrace: "^(Printexc.get_backtrace ()));
raise x)
我收到以下错误:
Backtrace: (Program not linked with -g, cannot print stack backtrace)
Fatal error: exception Not_found
(Program not linked with -g, cannot print stack backtrace)
那我该如何链接呢?
非常感谢
答案 0 :(得分:7)
可能使用错误消息建议的-g
标志。
将-g
标记添加到此行:$(CC) -o dpll $(LIBES) dpll.cmo