I have installed lablgtk in Cygwin and have compiled an example from this tutorial https://ocaml.org/learn/tutorials/introduction_to_gtk.html
ocamlfind ocamlc -g -package lablgtk2 -linkpkg simple.ml -o simple
However when I try to run the program with "run simple", nothing happens. I then compiled again, this time with the output as "simple.exe" and tried running this file with "./simple.exe". Now I get the following error:
Fatal error: cannot load shared library dlllablgtk2
Reason: %1 is not a valid Win32 application.
It should be noted that I was able to compile and run the program just a couple of days ago. I'm not sure what has changed since then and I'm not sure what to do next.
I do get the following warnings when compiling:
File "simple.ml", line 10, characters 2-44:
Warning 10: this expression should have type unit.
File "simple.ml", line 20, characters 2-54:
Warning 10: this expression should have type unit.
File "simple.ml", line 25, characters 2-69:
Warning 10: this expression should have type unit.
But this didn't prevent me from running the program previously. How can I resolve this issue?
I resolved the issue by re-adding MingGW to my path:
export PATH=$PATH:"/usr/x86_64-w64-mingw32/sys-root/mingw/bin"
I had done this previously, which is why the executables worked before, but it seems that it didn't save for the next time I logged on. Before, when I hadn't added the path, I wasn't able to install lablgtk and so unable to compile the program, so I was receiving a different error. This time lablgtk was installed, so while compilation was successful, I got a very different error which caused the confusion.