Cygwin cannot load shared library dlllablgtk2

时间:2016-04-04 17:36:28

标签: gtk cygwin ocaml

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?

1 个答案:

答案 0 :(得分:1)

我通过将MingGW重新添加到我的路径来解决了这个问题:

export PATH=$PATH:"/usr/x86_64-w64-mingw32/sys-root/mingw/bin"

我以前做过这个,这就是为什么可执行文件以前工作的原因,但它似乎没有保存下次我登录时。之前,当我没有添加路径时,我无法安装lablgtk,因此无法编译程序,所以我收到了一个不同的错误。这次lablgtk已经安装,所以在编译成功的时候,我得到了一个非常不同的错误,导致了混乱。