2012-12-14 40 views
0

我在caml中有一個小函數的問題。 這裏我的功能:Ocaml:異常Graphics.Graphic_failure(「Xlib錯誤:BadPixmap(無效的Pixmap參數)」)

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」,我有這樣的錯誤: Fatal error: exception Graphics.Graphic_failure("Xlib error: BadPixmap (invalid Pixmap parameter)")或段故障。

有人能解釋一下這種錯誤的原因嗎?謝謝:)

+0

您的代碼不起作用。 – didierc

+0

'q'按鈕是什麼? – didierc

+1

你應該嘗試提供一個最小化的可編譯程序來暴露你想要得到解釋的問題。 – didierc

回答

2

將不會有任何回覆您的問題,因爲它沒有足夠的信息。

一般來說,如果您遇到OCaml的分段錯誤,這是一個主要的BUG,所以您應該填寫一個關於OCaml bug tracker的錯誤報告,並上傳重現錯誤的程序。