Compilation 如何编译到不同的位置
我对使用a命令行编译代码非常陌生,所以我想知道如何让D编译器将其所有代码编译到某个位置,而不是源代码所在的位置。如中所示,我希望final.exe和obj代码都位于特定目录中。我知道你可以使用-of命令,但我目前不知道使用它的格式。 目前我有:Compilation 如何编译到不同的位置,compilation,d,flags,Compilation,D,Flags,我对使用a命令行编译代码非常陌生,所以我想知道如何让D编译器将其所有代码编译到某个位置,而不是源代码所在的位置。如中所示,我希望final.exe和obj代码都位于特定目录中。我知道你可以使用-of命令,但我目前不知道使用它的格式。 目前我有: C:\D\dmd2\windows\bin\dmd.exe -w C:\Users\Kyle\Desktop\D\Test.d C:\Users\Kyle\Desktop\D\src\MyMod.d 我需要添加什么?查看-of、-od和-op开关的-o
C:\D\dmd2\windows\bin\dmd.exe -w C:\Users\Kyle\Desktop\D\Test.d C:\Users\Kyle\Desktop\D\src\MyMod.d
我需要添加什么?查看
-of
、-od
和-op
开关的-of。如果不知道“将其所有代码编译到某个位置”的确切含义,就很难说得更具体一些。看看-of
、-od
和-op
开关的-of。如果不知道“将其所有代码编译到某个位置”的确切含义,就很难说得更具体一些。使用-offilename
开关。例如:
dmd factorial.d -offilename "d:\test_name.exe"
或简短版本:
dmd factorial.d "-ofd:\test_name.exe"
注意:如果路径包含空格,则必须使用双引号
注2:在短版本中,您可以跳过.exe
,但在完整版本中不要这样做,因为编译器将搜索具有该名称的源文件。使用-offilename
开关。例如:
dmd factorial.d -offilename "d:\test_name.exe"
或简短版本:
dmd factorial.d "-ofd:\test_name.exe"
注意:如果路径包含空格,则必须使用双引号
注2:在简短版本中,您可以跳过.exe
,但在完整版本中不要这样做,因为编译器将搜索具有该名称的源文件。我知道人们不喜欢RTFM答案,但下面是一种RTFM答案,可以回答您的问题:
执行dmd--help
,您将获得以下信息:
DMD32 D Compiler v2.061
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.dlang.org/index.html
Usage:
dmd files.d ... { -switch }
files.d D source files
@cmdfile read arguments from cmdfile
-c do not link
-cov do code coverage analysis
-D generate documentation
-Dddocdir write documentation file to docdir directory
-Dffilename write documentation file to filename
-d silently allow deprecated features
-dw show use of deprecated features as warnings (default)
-de show use of deprecated features as errors (halt compilation)
-debug compile in debug code
-debug=level compile in debug code <= level
-debug=ident compile in debug code identified by ident
-debuglib=name set symbolic debug library to name
-defaultlib=name set default library to name
-deps=filename write module dependencies to filename
-g add symbolic debug info
-gc add symbolic debug info, pretend to be C
-gs always emit stack frame
-H generate 'header' file
-Hddirectory write 'header' file to directory
-Hffilename write 'header' file to filename
--help print help
-Ipath where to look for imports
-ignore ignore unsupported pragmas
-inline do function inlining
-Jpath where to look for string imports
-Llinkerflag pass linkerflag to link
-lib generate library rather than object files
-man open web browser on manual page
-map generate linker .map file
-noboundscheck turns off array bounds checking for all functions
-O optimize
-o- do not write object file
-odobjdir write object & library files to directory objdir
-offilename name output file to filename <---- [1]
-op do not strip paths from source file
-profile profile runtime performance of generated code
-property enforce property syntax
-quiet suppress unnecessary messages
-release compile release version
-run srcfile args... run resulting program, passing args
-unittest compile in unit tests
-v verbose
-version=level compile in version code >= level
-version=ident compile in version code identified by ident
-vtls list all variables going into thread local storage
-w warnings as errors (compilation will halt)
-wi warnings as messages (compilation will continue)
-X generate JSON file
-Xffilename write JSON file to filename
DMD32 D编译器v2.061
版权所有(c)1999-2012由Walter Bright编写的数字火星
文档:http://www.dlang.org/index.html
用法:
dmd文件.d。。。{-switch}
文件.d源文件
@cmdfile从cmdfile读取参数
-c不链接
-cov do代码覆盖率分析
-D生成文档
-Dddocdir将文档文件写入docdir目录
-Dffilename将文档文件写入文件名
-d默认允许不推荐的功能
-dw将不推荐使用的功能显示为警告(默认)
-将不推荐使用的功能作为错误取消显示(暂停编译)
-调试代码中的调试编译
-debug=level在调试代码中编译我知道人们不喜欢RTFM答案,但下面是一种RTFM答案,可以回答您的问题:
执行dmd--help
,您将获得以下信息:
DMD32 D Compiler v2.061
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.dlang.org/index.html
Usage:
dmd files.d ... { -switch }
files.d D source files
@cmdfile read arguments from cmdfile
-c do not link
-cov do code coverage analysis
-D generate documentation
-Dddocdir write documentation file to docdir directory
-Dffilename write documentation file to filename
-d silently allow deprecated features
-dw show use of deprecated features as warnings (default)
-de show use of deprecated features as errors (halt compilation)
-debug compile in debug code
-debug=level compile in debug code <= level
-debug=ident compile in debug code identified by ident
-debuglib=name set symbolic debug library to name
-defaultlib=name set default library to name
-deps=filename write module dependencies to filename
-g add symbolic debug info
-gc add symbolic debug info, pretend to be C
-gs always emit stack frame
-H generate 'header' file
-Hddirectory write 'header' file to directory
-Hffilename write 'header' file to filename
--help print help
-Ipath where to look for imports
-ignore ignore unsupported pragmas
-inline do function inlining
-Jpath where to look for string imports
-Llinkerflag pass linkerflag to link
-lib generate library rather than object files
-man open web browser on manual page
-map generate linker .map file
-noboundscheck turns off array bounds checking for all functions
-O optimize
-o- do not write object file
-odobjdir write object & library files to directory objdir
-offilename name output file to filename <---- [1]
-op do not strip paths from source file
-profile profile runtime performance of generated code
-property enforce property syntax
-quiet suppress unnecessary messages
-release compile release version
-run srcfile args... run resulting program, passing args
-unittest compile in unit tests
-v verbose
-version=level compile in version code >= level
-version=ident compile in version code identified by ident
-vtls list all variables going into thread local storage
-w warnings as errors (compilation will halt)
-wi warnings as messages (compilation will continue)
-X generate JSON file
-Xffilename write JSON file to filename
DMD32 D编译器v2.061
版权所有(c)1999-2012由Walter Bright编写的数字火星
文档:http://www.dlang.org/index.html
用法:
dmd文件.d。。。{-switch}
文件.d源文件
@cmdfile从cmdfile读取参数
-c不链接
-cov do代码覆盖率分析
-D生成文档
-Dddocdir将文档文件写入docdir目录
-Dffilename将文档文件写入文件名
-d默认允许不推荐的功能
-dw将不推荐使用的功能显示为警告(默认)
-将不推荐使用的功能作为错误取消显示(暂停编译)
-调试代码中的调试编译
-debug=level在调试代码中编译我以为它是dmd factorial.d“-ofd:\test\u name.exe”
我打赌是这样的,因为dmd帮助中不清楚开关是什么,所以他们允许-of和-offilename:)和那些不喜欢开关与参数连接的人会讨厌dmd,因为他们不能做c:/path/to/file.exe的。@DejanLekic-offilename c:/path/to/file.exe的?@sigod我没有试过。。。太长了……:)我认为它是dmd factorial.d“-ofd:\test\u name.exe”
我打赌是这样的,因为dmd帮助中不清楚开关是什么,所以他们让-of和-offilename:)和那些不喜欢开关与参数连接的人会讨厌dmd,因为他们不能做c:/path/to/file.exe的。@DejanLekic-offilename c:/path/to/file.exe的?@sigod我没有试过。。。太长了……:)