Ubuntu 21.10にプログラミング言語nimをインストールする

1.nimをインストール

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt install curl build-essential
# curl https://nim-lang.org/choosenim/init.sh -sSf | sh
# sudo apt install curl build-essential # curl https://nim-lang.org/choosenim/init.sh -sSf | sh
# sudo apt install curl build-essential
# curl https://nim-lang.org/choosenim/init.sh -sSf | sh

2.PATHを通す

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# vi ~/.profile
末尾追加
export PATH=/home/[user]/.nimble/bin:$PATH
変更を反映
# source ~/.profile
# vi ~/.profile 末尾追加 export PATH=/home/[user]/.nimble/bin:$PATH 変更を反映 # source ~/.profile
# vi ~/.profile
末尾追加
export PATH=/home/[user]/.nimble/bin:$PATH

変更を反映
# source ~/.profile

3.nimバージョンを確認
# nim -v
Nim Compiler Version 1.4.2 [Linux: amd64]

4.動作確認
# vi test.nim
echo “study skill become smart"

ファイルをコンパイル

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# nim c test.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
....CC: stdlib_io.nim
CC: stdlib_system.nim
CC: test.nim
Hint: [Link]
Hint: 22375 lines; 5.076s; 25.539MiB peakmem; Debug build; proj: /root/test.nim; out: /root/test [SuccessX]
# nim c test.nim Hint: used config file '/etc/nim/nim.cfg' [Conf] Hint: used config file '/etc/nim/config.nims' [Conf] ....CC: stdlib_io.nim CC: stdlib_system.nim CC: test.nim Hint: [Link] Hint: 22375 lines; 5.076s; 25.539MiB peakmem; Debug build; proj: /root/test.nim; out: /root/test [SuccessX]
# nim c test.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
....CC: stdlib_io.nim
CC: stdlib_system.nim
CC: test.nim

Hint:  [Link]
Hint: 22375 lines; 5.076s; 25.539MiB peakmem; Debug build; proj: /root/test.nim; out: /root/test [SuccessX]

実行確認
# ./test
study skill become smart

Ubuntu 21.10

Posted by arkgame