Ocaml:exception Graphics.Graphic故障(“Xlib错误:BadPixmap(无效的Pixmap参数)”)

Ocaml:exception Graphics.Graphic故障(“Xlib错误:BadPixmap(无效的Pixmap参数)”),ocaml,Ocaml,我对caml中的一个小函数有个问题。 以下是我的职能: let show img = let h = height img in let w = width img in open_graph (" "^string_of_int w^"x"^string_of_int h); set_window_title "Seam Carving"; draw img; if Graphics.key_pressed() then match Graphics.re

我对caml中的一个小函数有个问题。 以下是我的职能:

let show img = 
  let h = height img in 
  let w = width img in
  open_graph (" "^string_of_int w^"x"^string_of_int h);
  set_window_title "Seam Carving";
  draw img;
  if Graphics.key_pressed() then 
    match Graphics.read_key() with
      | 'q' -> close_graph()
      | _ -> ()
;;
当我点击“q”按钮时,我发现以下错误:
致命错误:图形异常。图形故障(“Xlib错误:BadPixmap(无效的Pixmap参数)”)
或分段故障


有人能给我解释一下这种错误的原因吗?谢谢:)

由于您的问题中没有足够的信息,因此将不会有任何答复


通常,如果您遇到OCaml的分段错误,这是一个主要错误,因此您应该填写错误报告,并上传一个程序来重现错误。

您应该尝试提供一个最小的可编译程序,以暴露您想要得到解释的问题。