How to fix the Unbound module Graphics in an ocaml project

Image
From ~/pr/gitl/ocaml-gol In a constant effort to learn new programming languages, I'm currently trying to use ocaml , a free and open-source general-purpose, multi-paradigm programming language maintained at the Inria . It's basically an extension of Caml with object-oriented features. I'm mostly interested by its functionnal and pattern matching features but the module part of the language can be a bit difficult to understand for someone with little to none ML (Meta Language) background.   The error When trying to use the graphics module to create a graphical window and go just a little further than the simplest helloworld program, here is the result : If the project uses dune : (executable (name ocaml_project) (libraries lwt.unix graphics) ) with this code : let () = Printf.printf "Hello, world!\n";; Lwt_io.printf "Hello, world!\n";; Graphics.open_graph " 800x600";; The first times I built this project running the du

Introducting the todoSummarizer's help viewer

Today's commit was about a help viewer for todoSummarizer. All this code resides in the lib/MainWindow.rb

Since this project uses GTK, I decided to use an external help viewer : yelp.

The project already have a texinfo manual, so it's all about generating HTML from info and pass the corrcet URI to yelp.

Generating HTML manual

To generate HTML from an info file you only need to run the following command :
makeinfo --html todoSummarizer.texinfo
It will create a new directory containing some HTML files.

Calling yelp from ruby

I also have some issues with Dir.pwd() so I didn't use it. Instead I used the __dir__ ruby function.

Appart for the error checking code, calling yelp from ruby is only three lines away :
yelp = find_executable("yelp")
uri = "file://#{dir.to_path}/../doc/todoSummarizer/index.html"
Thread.new { 
  cmd = system("#{yelp} #{uri}") 
}

Result

You now have a great manual/help viewer for your GTK-based GUI application :
The todoSummarizer's help viewer

Comments

Popular posts from this blog

How to make a map of variant in C++