Options for Directory Search#
These options specify directories to search for files, libraries, and other parts of the compiler:
- -Idir#
Specify a directory to use when searching for imported modules at compile time. Multiple
-I
options can be used, and the paths are searched in the same order.
- -Jdir#
Specify a directory to use when searching for files in string imports at compile time. This switch is required in order to use
import(file)
expressions. Multiple-J
options can be used, and the paths are searched in the same order.
- -Ldir#
When linking, specify a library search directory, as with gcc.
- -Bdir#
This option specifies where to find the executables, libraries, source files, and data files of the compiler itself, as with gcc.
- -fmodule-file=module=spec#
This option manipulates file paths of imported modules, such that if an imported module matches all or the leftmost part of
module
, the file path inspec
is used as the location to search for D sources. This is used when the source file path and names are not the same as the package and module hierarchy. Consider the following examples:gdc test.d -fmodule-file=A.B=foo.d -fmodule-file=C=bar
This will tell the compiler to search in all import paths for the source file
foo.d
when importingA.B
, and the directorybar/
when importingC
, as annotated in the following D code:module test; import A.B; // Matches A.B, searches for foo.d import C.D.E; // Matches C, searches for bar/D/E.d import A.B.C; // No match, searches for A/B/C.d
- -imultilib dir#
Use
dir
as a subdirectory of the gcc directory containing target-specific D sources and interfaces.
- -iprefix prefix#
Specify
prefix
as the prefix for the gcc directory containing target-specific D sources and interfaces. If theprefix
represents a directory, you should include the final'/'
.