编译Nim程序nim c -r example.nim创建输出文件example.我想在另一个文件夹中创建一个输出文件,其名称bin/example.o更容易gitignore.
到目前为止我尝试过的:
nim c -r example.nim -o:bin/example.o
nim c -r example.nim --out:bin/example.o
nim c -r example.nim -o:example.o
nim c -r example.nim --out:example.o
Run Code Online (Sandbox Code Playgroud)
所有这些尝试的结果与我省略-o/--out选项的结果example相同,从而导致与文件位于同一文件夹中的可执行example.nim文件.如果我没有传递选项,编译器甚至不接受该选项-r(这让我觉得我误解了该选项的目的).
我正在使用从github devel分支源安装和编译的Nim 0.10.3 .
什么编译器选项允许我修改编译的输出文件?
你在做什么是对的,但选项必须在你编译的文件之前。您指定-r在编译后执行文件,因此它将使用文件后指定的所有参数运行。
所以这应该有效:
nim c -o:bin/example -r example.nim
nim c -o=bin/example -r example.nim
nim c --out:bin/example -r example.nim
nim c --out=bin/example -r example.nim
Run Code Online (Sandbox Code Playgroud)