How to fix the Unbound module Graphics in an ocaml project

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

How to use in a C/C++ project

If you need a good code coverage web reporting tool for a github-hosted project, may be your next best friend. I'm already using it on biology and rainbrurpg).

The present article is usable on a C/C++ project using cmake as build system and travis-ci as CI platform. screenshot screenshot

Handling coverage in cmake

You first need to install some package (at least on Debian GNU/Linux) :
sudo apt install gcov lcov gcovr

Then, copy the CodeCoverage.cmake in a cmake/ directory inside your project's repository and add this line to your CMakeLists.txt file:

Generate coverage reports and send them

Now, you need to modify your .travis.yml file and add this :
  # Creating report
  - lcov --version
  - lcov --directory . --capture --output-file
  - lcov --remove '/usr/*' --output-file
  - lcov --list #debug info
  # Uploading report to CodeCov
  - bash <(curl -s || echo "Codecov did not collect coverage reports"


Popular posts from this blog

How to make a map of variant in C++

How to use Qt5 ui form in C++ with cmake