日期:2014-05-16  浏览次数:20892 次

Windows下命令行直接编译程序

D:\>cl hello.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

hello.cpp
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:hello.exe
hello.obj

D:\>hello.exe
Hello world !!!

D:\>cl -help
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

                          C/C++ COMPILER OPTIONS

                              -OPTIMIZATION-

/O1 minimize space                       /Op[-] improve floating-pt consistency
/O2 maximize speed                       /Os favor code space
/Oa assume no aliasing                   /Ot favor code speed
/Ob<n> inline expansion (default n=0)    /Ow assume cross-function aliasing
/Od disable optimizations (default)      /Ox maximum opts. (/Ogityb1 /Gs)
/Og enable global optimization           /Oy[-] enable frame pointer omission
/Oi enable intrinsic functions

                             -CODE GENERATION-

/G3 optimize for 80386                   /Gy separate functions for linker
/G4 optimize for 80486                   /Ge force stack checking for all funcs
/G5 optimize for Pentium                 /Gs[num] disable stack checking calls
/G6 optimize for Pentium Pro             /Gh enable hook function call
/GB optimize for blended model (default) /GR[-] enable C++ RTTI
/Gd __cdecl calling convention           /GX[-] enable C++ EH (same as /EHsc)
/Gr __fastcall calling convention        /Gi[-] enable incremental compilation
/Gz __stdcall calling convention         /Gm[-] enable minimal rebuild
/GA optimize for Windows Application     /EHs enable synchronous C++ EH
/GD optimize for Windows DLL             /EHa enable asynchronous C++ EH
(press <return> to continue)
/Gf enable string pooling                /EHc extern "C" defaults to nothrow
/GF enable read-only string pooling      /QIfdiv[-] enable Pentium FDIV f