HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

nim — The Nim compiler. Process, compile, and link Nim language source files. More information: <https://n

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandnimprocesscompileclicompiler

Problem

How to use the nim command: The Nim compiler. Process, compile, and link Nim language source files. More information: <https://nim-lang.org/docs/nimc.html>.

Solution

nim — The Nim compiler. Process, compile, and link Nim language source files. More information: <https://nim-lang.org/docs/nimc.html>.

Compile a source file:
nim {{[c|compile]}} {{path/to/file.nim}}


Compile and run a source file:
nim {{[c|compile]}} {{[-r|--run]}} {{path/to/file.nim}}


Compile a source file with release optimizations enabled:
nim {{[c|compile]}} {{[-d|--define]}}:release {{path/to/file.nim}}


Build a release binary optimized for low file size:
nim {{[c|compile]}} {{[-d|--define]}}:release --opt:size {{path/to/file.nim}}


Generate HTML documentation for a module (output will be placed in the current directory):
nim doc {{path/to/file.nim}}


Check a file for syntax and semantics:
nim check {{path/to/file.nim}}

Code Snippets

Compile a source file

nim {{[c|compile]}} {{path/to/file.nim}}

Compile and run a source file

nim {{[c|compile]}} {{[-r|--run]}} {{path/to/file.nim}}

Compile a source file with release optimizations enabled

nim {{[c|compile]}} {{[-d|--define]}}:release {{path/to/file.nim}}

Build a release binary optimized for low file size

nim {{[c|compile]}} {{[-d|--define]}}:release --opt:size {{path/to/file.nim}}

Generate HTML documentation for a module (output will be placed in the current directory)

nim doc {{path/to/file.nim}}

Context

tldr-pages: common/nim

Revisions (0)

No revisions yet.