0

コマンドラインを使用してコードをコンパイルするのは初めてなので、Dコンパイラにすべてのコードをソースではなく特定の場所にコンパイルさせる方法を考えていました。のように、最終的な .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

何を追加する必要がありますか?

4

3 に答える 3

2

スイッチを使用-offilenameします。例:

dmd factorial.d -offilename "d:\test_name.exe"

または短いバージョン:

dmd factorial.d "-ofd:\test_name.exe"

注: パスにスペースが含まれている場合は、二重引用符が必要です。

注 2: 短いバージョンではスキップできますが.exe、フル バージョンではスキップしないでください。これは、コンパイラがその名前のソース ファイルを検索するためです。

于 2013-02-18T16:24:41.550 に答える
1

人々が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

あなたの質問に答える行に[1]と矢印を付けました。

于 2013-02-19T08:42:14.353 に答える
0

-of-odおよび-opスイッチを見てください。「すべてのコードを特定の場所にコンパイルする」とはどういう意味かを正確に知らずに、より具体的にすることは困難です。

于 2013-02-18T16:05:26.003 に答える