I'm new to NIM and I want to find out if it fits my needs. I use Ubuntu-Linux and tried to cross-compile a gtk4-file for Windows (I followed the instructions from https://ssalewski.de/gtkprogramming.html and https://nim-lang.github.io/Nim/nimc.html#cross-compilation-for-windows). I installed libgtk-4-dev and
nimble install gintro
Then I compiled on Linux:
nim c example.nim
I get an executable file that works on Linux.
Then I tried to cross-compile the file:
nim c -d:mingw example.nim nim r -d:mingw --cpu:amd64 --eval:'import os; echo "a" / "b"'
If I run the file on Windows 7 I get the error "could not load libglib-2.0.so.0". Please can you give me some advice what to do?
If I run the file on Windows 7 I get the error "could not load libglib-2.0.so.0".
Seems to be obvious: A "nimble install gintro" behaves very different on Mac, Linux and Windows. One important point is, that on Windows dynamic libraries may have the extension dll, while on Linux extension is so. But there may be more serious differences, and the wrapper modules are different for 32 and 64 bit OS. So cross-compile should be nearly impossible for gintro. Actually I am not even sure if gintro works with an 32-bit OS -- it should, but has never been tested, so some fixes may be necessary. You may get a Windows box, install gintro there, and create the executable there, after installing GTK. Some people have managed to do that, there may be more detailed references in the github issue tracker, the README or the GTK4 Nim book, I can not remember and can currently not find it. I will not further comment to this issue here, but if you really need more info, you may use the gintro issue tracker.
General advice: Just use one of the 20 other GUI toolkits. Learning GTK is very difficult, and Windows users do not like GTK that much.