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

Introducing libwsmeta

I would like to speak about a new project : libwsmeta, a C metaserver library intended to be used for several projects including rainbrurpg and rainbrurph.

This library will have to search for a server list. I've designed it to be included in cmake-based project.

The libwsmeta's bitbucket homepage

The design

The library will use a  peer to peer approach to find and propagate new game servers.
  1. The server download the entry-point and contact it. The entry-point is the main server(s) of the game. Its IP:port pair is publicly available from a public URL;
  2. The server directly contact the entry-point server and add itself to the server list before it returns the new list;
  3. It will then contact next server in the list with the same effects.

Using libwsmeta as a git submodule

As a developper

If you want to add this library in the ext/ directory :
mkdir ext
cd ext
git submodule add https://github.com/rainbru/libwsmeta
and add this line to the top-level CMakeFiles.txt
include("${PROJECT_SOURCE_DIR}/ext/libwsmeta/src/lib/CMakeLists.txt")
Now, you have to use two variables, defined by the included CMakeLists.txt file : LIBWSM_INCLUDES and LIBWSM_LIBRARIES.
include_directories(${LIBWSM_INCLUDES})
TARGET_LINK_LIBRARIES(YOUT_PROJECT ${LIBWSM_LIBRARIES})
Now, to update the subrepository, go to ext/libwsmeta and update it :
git checkout master
git pull

As a user

The user will have to perform two more step before being able to build the repository that uses this library :
git submodule init
git submodule update
The library will be built as a shared library along with the main project. No undefined references should occur.

Comments

Popular posts from this blog

How to make a map of variant in C++