Avoid problems when installing Nim on Windows

First off, decide if you want to go for x64 or x86 and stick to that choice, whenever you are provided with such a choice. x64 seems to work fine.

Installation instructions for Nim 0.10.2 on Windows

  • Download .exe installer

  • Execute it

  • Check "C Compiler (MinGW)". Everything else that is not already checked is optional but is nice to have.

  • "C:\Nim" installation path works well.

A problem you may run into is an already existing MinGW compiler in your PATH, so watch out for that.
Bit-ness difference may give a problem like size of array 'assert_numbits' is negative.

You should have "C:\Nim\dist\mingw;C:\Nim\dist\mingw\bin;C:\Nim\bin;C:\Nim\dist\babel" at the end of your PATH. You shouldn't need to add this manually (unless you're using Wine). Error: unhandled exception: The system cannot find the file specified. means the C compiler was not found and something may be wrong with PATH.

Now you have a working Nim compiler. Make a file hello.nim with the contents echo "Hello, World", navigate to the directory in cmd, and run nim c -r hello.nim, which should produce the obvious result.
Paths/filenames with spaces do not work!

Alternatively (or additionally) write echo "Hello, World" in Aporia, press F5 (select C:\Nim\bin\nim.exe if asked for an executable) and see the result at the bottom.

Installation instructions for Nimble 0.6 on Windows

You will most likely need Nimble to install Nim libraries. Otherwise managing libraries will be a huge pain.

  • Download Nimble 0.6

  • Extract the archive (to a location without spaces in path)

  • Execute install.bat. Everything should just work.

  • Now %USERPROFILE%\.nimble\bin\nimble.cmd should exist (USERPROFILE is C:\Users\User)

    • You may want to add %USERPROFILE%\.nimble\bin to PATH.

Most libraries will be installed using Git, so it's pretty useless without it.

Other libraries can use other installation methods. The only other one I can think of is Mercurial (hg), so you may need to...

could not load: (ssleay32|libssl32).dll?

  • Download and install OpenSSL

    • The option I went for was "Pre-compiled Win32/64 libraries without external dependencies", which should be 2nd (3rd) to last file here. You can extract the archive (possibly omitting .txt files) to C:\Nim\bin or some system folder.

Now you can go to cmd and install libraries, e.g. nimble install docopt. Try out the example of docopt. Browse libraries.

Created (last updated )
Comments powered by Disqus