← 返回命令列表

Linux command

dmd 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Compile D source

dmd [file.d]

Compile with output

dmd -of=[output] [file.d]

Compile with optimizations

dmd -O [file.d]

Compile to object

dmd -c [file.d]

Include import paths

dmd -I[/path/to/imports] [file.d]

Enable all warnings

dmd -w [file.d]

Generate debug info

dmd -g [file.d]

说明

dmd is the reference compiler for the D programming language. It compiles D source code to native machine code, supporting the full D language specification including templates, mixins, and compile-time function execution. D combines the power of low-level programming with modern language features like garbage collection, closures, and built-in unit testing. dmd provides fast compilation suitable for rapid development cycles. The compiler includes a standard library (Phobos) with extensive functionality for common programming tasks, and supports interfacing with C and C++ code.

参数

-of=_FILE_
Output file name.
-O
Enable optimizations.
-c
Compile only (no link).
-I_PATH_
Add import path.
-w
Enable all warnings.
-g
Generate debug information.
-release
Compile for release (disable asserts).
-unittest
Compile and run unit tests.
--help
Display help information.

FAQ

What is the dmd command used for?

dmd is the reference compiler for the D programming language. It compiles D source code to native machine code, supporting the full D language specification including templates, mixins, and compile-time function execution. D combines the power of low-level programming with modern language features like garbage collection, closures, and built-in unit testing. dmd provides fast compilation suitable for rapid development cycles. The compiler includes a standard library (Phobos) with extensive functionality for common programming tasks, and supports interfacing with C and C++ code.

How do I run a basic dmd example?

Run `dmd [file.d]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -of=_FILE_ do in dmd?

Output file name.