如何在没有控制台的情况下在Windows下创建或编译GUI应用程序? 我已经搜索了互联网,但我没有找到任何有用的东西。我很感激您提供的任何指导。
(* ocamlc -I +labltk labltk.cma gui.ml -o gui.exe *)
open Tk ;;
let top = openTk () ;;
Wm.title_set top "Application 1" ;;
Wm.geometry_set top "200x500";;
let blue = Button.create ~text:"Blue" top ;;
let red = Button.create ~text:"Red" top ;;
pack [blue ; red];;
let mylist = Listbox.create ~selectmode:`Multiple top
let _ = Listbox.insert
~index:`End
~texts:["Mozart";"Chopin";"Beethoven";"Verdi";"Bizet"]
mylist ;;
pack [mylist];;
let _ = Printexc.print mainLoop ();;
答案 0 :(得分:4)
你需要将'-subsystem windows'传递给链接器;并且可能是'-custom',因为ocamlrun.exe是一个控制台应用程序:
ocamlc -I +labltk labltk.cma gui.ml -custom -cclib -subsystem -cclib windows -o gui.exe
答案 1 :(得分:2)
我自己主要是OS X / Unix / Linux程序员,但您可以尝试使用其他SO页面:
Hide console of Windows Application
关键因素似乎是链接器选项和入口点名称。