How to install Nim programming language

Install Nim lang on Windows

Following the guide on https://nim-lang.org/install_windows.html

Assuming you have Git for Windows and Gow installed

cd ~/Downloads
wget https://nim-lang.org/download/nim-1.0.2_x32.zip
unzip *.zip
mv nim-1* ../nim32

Then Clicking nim32/finish.exe to download MinGw and set PATH

First Nim program

Run nim in Command Prompt, if it reports its version and usage, we're good to continue

Run "hello World" nim program

mkdir -p code/nim/hello
cd code/nim/hello
touch hello.nim

echo "Hello EasiestSoft.com" > hello.nim

nim c hello.nim
./hello

How to build res file with MinGW on Windows

%NIMPATH%\dist\mingw32\bin\windres -O coff EasiestSoft.rc -o 32.res
%NIMPATH%\dist\mingw64\bin\windres -O coff EasiestSoft.rc -o 64.res

EasiestSoft.rc:

1000 ICON "EasiestSoft.ico"

linking res file to exe on Windows

Adding following code to source code:

when defined(gcc) and defined(windows):
when defined(x86):
	{.link: "res/32.res".}
else:
	{.link: "res/64.res".}

Install choosenim ?

choosenim does not have the option of installing the x86 version of Nim, which is useless for me

Reference:

  • https://github.com/khchen/wNim/blob/master/examples/resource/build.cmd

©2012-2019 EasiestSoft