When I compile my app on windows, it opens a dos window when I run it. But if I use the --app:gui option to supress that behavior, the compile fails with the message that it cannot find lgdi32 or lcomdlg32.
This article http://forum.nim-lang.org/t/953#5758 suggests that I need to install the full mingw32, so I did that. But nim still gets the same compiler error. I have changed my path so that it points to my install of mingw, but when the error happens, you can see that it is still running the version of mingw relative to the nim installation.
So the question now is how do I get Nim to use the correct MinGW installation?
Is that actually the fix? I remember this issue back in the day with VB6 game programming, and there was a patch you could apply after the exe was created that would get rid of the console window. Would something similar work with Nim?
Nim compiler can take MinGW path from config/nim.cfg, try to change it there.
there was a patch you could apply after the exe was created that would get rid of the console window. Would something similar work with Nim?
Yes, or you can try to edit generated C files (in nimcache folder) and compile them then.
My example:
First, change config:
config/nim.cfg cc = vcc
and then build:
nim c --cpu:i386 -t:/MD -l:gui.res --app:gui --clib:%PlatformSDK%\\Lib\\user32 -d:release gui.nim
--cpu:i386 for win32, optional
-t:/MD for dyn link to msvcr, optional
-l:gui.res for ico and version info ,etc , optional
--clib:%PlatformSDK%\Lib\user32 for user32.lib , note: do not add *lib* suffix, you can add more clibs , or you can add lib inside nim file using {.link user32 .} (I do not test yet)
There's some related notes here:
http://forum.nim-lang.org/t/1531
And perhaps here:
http://www.transmissionzero.co.uk/computing/win32-apps-with-mingw/