2013-02-18 2 views
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 

Что мне нужно добавить?

ответ

2

Использование -offilename выключатель. Пример:

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

или короткая версия:

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

Примечание: двойные кавычки необходимы, если ваш путь содержит пробелы.

Примечание2: В короткой версии вы можете пропустить .exe, но не делают это в полной версии, так как компилятор будет искать исходный файл с таким именем.

+3

Я думал, что это 'dmd factorial.d" -ofd: \ test_name.exe "' –

+0

@ratchetfreak это тоже работает. – sigod

+1

Держу пари, что это так, потому что непонятно, что такое переключатель, из справки DMD, поэтому они позволяют обоим и -offlename :) – DejanLekic

0

Посмотрите на переключатели -of, -od и -op. Трудно быть более конкретным, не зная, что именно вы имеете в виду, «скомпилируйте весь его код в определенном месте».

1

Я знаю, что люди не любят RTFM ответов, но следующий вид RTFM ответа, который отвечает на ваш вопрос:

Execute 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 

I ознаменовало line, который отвечает на ваш вопрос [1] и стрелка.

Смежные вопросы