﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客--随笔分类-tools</title><link>http://www.cppblog.com/hkingSP/category/21383.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 09 Mar 2019 03:41:59 GMT</lastBuildDate><pubDate>Sat, 09 Mar 2019 03:41:59 GMT</pubDate><ttl>60</ttl><item><title>cl command</title><link>http://www.cppblog.com/hkingSP/archive/2019/03/09/216292.html</link><dc:creator>宋鹏</dc:creator><author>宋鹏</author><pubDate>Sat, 09 Mar 2019 03:23:00 GMT</pubDate><guid>http://www.cppblog.com/hkingSP/archive/2019/03/09/216292.html</guid><wfw:comment>http://www.cppblog.com/hkingSP/comments/216292.html</wfw:comment><comments>http://www.cppblog.com/hkingSP/archive/2019/03/09/216292.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/hkingSP/comments/commentRss/216292.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/hkingSP/services/trackbacks/216292.html</trackback:ping><description><![CDATA[<div>搞懂编译过程 编译器都在干嘛<br /><div>cl -I 包含需要的目录，其命令的结尾往往是一个.c或.cpp文件。<br />cl命令出错，一般是无法找到需要的头文件。</div><br />附录：cl -help<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;C/C++ COMPILER OPTIONS</div><div></div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -OPTIMIZATION-</div><div></div><div>/O1 minimize space&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /O2 maximize speed</div><div>/Ob&lt;n&gt; inline expansion (default n=0)&nbsp; &nbsp;/Od disable optimizations (default)</div><div>/Og enable global optimization&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Oi[-] enable intrinsic functions</div><div>/Os favor code space&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Ot favor code speed</div><div>/Ox maximum optimizations&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Oy[-] enable frame pointer omission&nbsp;</div><div>/favor:&lt;blend|ATOM&gt; select processor to optimize for, one of:</div><div>&nbsp; &nbsp; blend - a combination of optimizations for several different x86 processors</div><div>&nbsp; &nbsp; ATOM - Intel(R) Atom(TM) processors&nbsp;</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-CODE GENERATION-</div><div></div><div>/Gw[-] separate global variables for linker</div><div>/GF enable read-only string pooling&nbsp; &nbsp; &nbsp;/Gm[-] enable minimal rebuild</div><div>/Gy[-] separate functions for linker&nbsp; &nbsp; /GS[-] enable security checks</div><div>/GR[-] enable C++ RTTI&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /GX[-] enable C++ EH (same as /EHsc)</div><div>/guard:cf[-] enable CFG (control flow guard)</div><div>/EHs enable C++ EH (no SEH exceptions)&nbsp; /EHa enable C++ EH (w/ SEH exceptions)</div><div>/EHc extern "C" defaults to nothrow&nbsp; &nbsp; &nbsp;</div><div>/EHr always generate noexcept runtime termination checks</div><div>/fp:&lt;except[-]|fast|precise|strict&gt; choose floating-point model:</div><div>&nbsp; &nbsp; except[-] - consider floating-point exceptions when generating code</div><div>&nbsp; &nbsp; fast - "fast" floating-point model; results are less predictable</div><div>&nbsp; &nbsp; precise - "precise" floating-point model; results are predictable</div><div>&nbsp; &nbsp; strict - "strict" floating-point model (implies /fp:except)</div><div>/Qfast_transcendentals generate inline FP intrinsics even with /fp:except</div><div>/Qpar[-] enable parallel code generation</div><div>/Qpar-report:1 auto-parallelizer diagnostic; indicate parallelized loops</div><div>/Qpar-report:2 auto-parallelizer diagnostic; indicate loops not parallelized</div><div>/Qvec-report:1 auto-vectorizer diagnostic; indicate vectorized loops</div><div>/Qvec-report:2 auto-vectorizer diagnostic; indicate loops not vectorized</div><div>/GL[-] enable link-time code generation&nbsp;</div><div>/volatile:&lt;iso|ms&gt; choose volatile model:</div><div>&nbsp; &nbsp; iso - Acquire/release semantics not guaranteed on volatile accesses</div><div>&nbsp; &nbsp; ms&nbsp; - Acquire/release semantics guaranteed on volatile accesses</div><div>/GA optimize for Windows Application&nbsp; &nbsp; /Ge force stack checking for all funcs</div><div>/Gs[num] control stack checking calls&nbsp; &nbsp;/Gh enable _penter function call</div><div>/GH enable _pexit function call&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/GT generate fiber-safe TLS accesses</div><div>/RTC1 Enable fast checks (/RTCsu)&nbsp; &nbsp; &nbsp; &nbsp;/RTCc Convert to smaller type checks</div><div>/RTCs Stack Frame runtime checking&nbsp; &nbsp; &nbsp; /RTCu Uninitialized local usage checks</div><div>/clr[:option] compile for common language runtime, where option is:</div><div>&nbsp; &nbsp; pure - produce IL-only output file (no native executable code)</div><div>&nbsp; &nbsp; safe - produce IL-only verifiable output file</div><div>&nbsp; &nbsp; initialAppDomain - enable initial AppDomain behavior of Visual C++ 2002</div><div>&nbsp; &nbsp; noAssembly - do not produce an assembly</div><div>&nbsp; &nbsp; nostdlib - ignore the default \clr directory</div><div>/Gd __cdecl calling convention&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Gr __fastcall calling convention</div><div>/Gz __stdcall calling convention&nbsp; &nbsp; &nbsp; &nbsp; /GZ Enable stack checks (/RTCs)</div><div>/Gv __vectorcall calling convention&nbsp; &nbsp; &nbsp;/QIfist[-] use FIST instead of ftol()</div><div>/hotpatch ensure function padding for hotpatchable images</div><div>/arch:&lt;IA32|SSE|SSE2|AVX|AVX2&gt; minimum CPU architecture requirements, one of:</div><div>&nbsp; &nbsp;IA32 - use no enhanced instructions and use x87 for floating point</div><div>&nbsp; &nbsp;SSE - enable use of instructions available with SSE-enabled CPUs</div><div>&nbsp; &nbsp;SSE2 - (default) enable use of instructions available with SSE2-enabled CPUs</div><div>&nbsp; &nbsp;AVX - enable use of instructions available with AVX-enabled CPUs</div><div>&nbsp; &nbsp;AVX2 - enable use of instructions available with AVX2-enabled CPUs</div><div>/Qimprecise_fwaits generate FWAITs only on "try" boundaries, not inside "try"</div><div>/Qsafe_fp_loads generate safe FP loads&nbsp;&nbsp;</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -OUTPUT FILES-</div><div></div><div>/Fa[file] name assembly listing file&nbsp; &nbsp; /FA[scu] configure assembly listing</div><div>/Fd[file] name .PDB file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Fe&lt;file&gt; name executable file</div><div>/Fm[file] name map file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Fo&lt;file&gt; name object file</div><div>/Fp&lt;file&gt; name precompiled header file&nbsp; /Fr[file] name source browser file</div><div>/FR[file] name extended .SBR file&nbsp; &nbsp; &nbsp; &nbsp;/Fi[file] name preprocessed file</div><div>/Fd: &lt;file&gt; name .PDB file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Fe: &lt;file&gt; name executable file</div><div>/Fm: &lt;file&gt; name map file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Fo: &lt;file&gt; name object file</div><div>/Fp: &lt;file&gt; name .PCH file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /FR: &lt;file&gt; name extended .SBR file</div><div>/Fi: &lt;file&gt; name preprocessed file&nbsp; &nbsp; &nbsp;&nbsp;</div><div>/doc[file] process XML documentation comments and optionally name the .xdc file</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -PREPROCESSOR-</div><div></div><div>/AI&lt;dir&gt; add to assembly search path&nbsp; &nbsp; /FU&lt;file&gt; forced using assembly/module&nbsp;</div><div>/C don't strip comments&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/D&lt;name&gt;{=|#}&lt;text&gt; define macro</div><div>/E preprocess to stdout&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/EP preprocess to stdout, no #line</div><div>/P preprocess to file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Fx merge injected code to file</div><div>/FI&lt;file&gt; name forced include file&nbsp; &nbsp; &nbsp; /U&lt;name&gt; remove predefined macro</div><div>/u remove all predefined macros&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/I&lt;dir&gt; add to include search path</div><div>/X ignore "standard places"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -LANGUAGE-</div><div></div><div>/Zi enable debugging information&nbsp; &nbsp; &nbsp; &nbsp; /Z7 enable old-style debug info</div><div>/Zp[n] pack structs on n-byte boundary&nbsp; /Za disable extensions</div><div>/Ze enable extensions (default)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Zl omit default library name in .OBJ</div><div>/Zs syntax check only&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/vd{0|1|2} disable/enable vtordisp</div><div>/vm&lt;x&gt; type of pointers to members&nbsp; &nbsp; &nbsp;&nbsp;</div><div>/Zc:arg1[,arg2] C++ language conformance, where arguments can be:</div><div>&nbsp; forScope[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;enforce Standard C++ for scoping rules</div><div>&nbsp; wchar_t[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wchar_t is the native type, not a typedef</div><div>&nbsp; auto[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;enforce the new Standard C++ meaning for auto</div><div>&nbsp; trigraphs[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; enable trigraphs (off by default)</div><div>&nbsp; rvalueCast[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;enforce Standard C++ explicit type conversion rules</div><div>&nbsp; strictStrings[-]&nbsp; &nbsp; &nbsp; disable string-literal to [char|wchar_t]*</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conversion (off by default)</div><div>&nbsp; implicitNoexcept[-]&nbsp; &nbsp;enable implicit noexcept on required functions</div><div>&nbsp; threadSafeInit[-]&nbsp; &nbsp; &nbsp;enable thread-safe local static initialization</div><div>&nbsp; inline[-]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;remove unreferenced function or data if it is</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COMDAT or has internal linkage only (off by default)</div><div>&nbsp; sizedDealloc[-]&nbsp; &nbsp; &nbsp; &nbsp;enable C++14 global sized deallocation</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; functions (on by default)</div><div>&nbsp; throwingNew[-]&nbsp; &nbsp; &nbsp; &nbsp; assume operator new throws on failure (off by default)</div><div>&nbsp; referenceBinding[-]&nbsp; &nbsp;a temporary will not bind to an non-const</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvalue reference (off by default)</div><div>/ZH:SHA_256&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;use SHA256 for file checksum in debug info (experimental)</div><div></div><div>/Zo[-] generate richer debugging information for optimized code (on by default)</div><div>/ZW enable WinRT language extensions&nbsp; &nbsp;&nbsp;</div><div>/constexpr:depth&lt;N&gt;&nbsp; &nbsp; &nbsp;use &lt;N&gt; as the recursion depth limit</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for constexpr (default: 512)</div><div>/constexpr:backtrace&lt;N&gt; show &lt;N&gt; constexpr evaluations</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in diagnostics (default: 10)</div><div>/constexpr:steps&lt;N&gt;&nbsp; &nbsp; &nbsp;terminate constexpr evaluation after</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;N&gt; steps (default: 100000)</div><div>/ZI enable Edit and Continue debug info&nbsp;</div><div>/openmp enable OpenMP 2.0 language extensions</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -MISCELLANEOUS-</div><div></div><div>@&lt;file&gt; options response file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/?, /help print this help message</div><div>/bigobj generate extended object format /c compile only, no link</div><div>/errorReport:option Report internal compiler errors to Microsoft</div><div>&nbsp; &nbsp; none - do not send report&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; prompt - prompt to immediately send report</div><div>&nbsp; &nbsp; queue - at next admin logon, prompt to send report (default)</div><div>&nbsp; &nbsp; send - send report automatically&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>/FC use full pathnames in diagnostics&nbsp; &nbsp;/H&lt;num&gt; max external name length</div><div>/J default char type is unsigned&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>/MP[n] use up to 'n' processes for compilation</div><div>/nologo suppress copyright message&nbsp; &nbsp; &nbsp;&nbsp;</div><div>/sdl enable additional security features and warnings</div><div>/showIncludes show include file names&nbsp; &nbsp;/Tc&lt;source file&gt; compile file as .c</div><div>/Tp&lt;source file&gt; compile file as .cpp&nbsp; &nbsp;/TC compile all files as .c</div><div>/TP compile all files as .cpp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/V&lt;string&gt; set version string</div><div>/w disable all warnings&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/wd&lt;n&gt; disable warning n</div><div>/we&lt;n&gt; treat warning n as an error&nbsp; &nbsp; &nbsp; /wo&lt;n&gt; issue warning n once</div><div>/w&lt;l&gt;&lt;n&gt; set warning level 1-4 for n&nbsp; &nbsp; /W&lt;n&gt; set warning level (default n=1)</div><div>/Wall enable all warnings&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/WL enable one line diagnostics</div><div>/WX treat warnings as errors&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /Yc[file] create .PCH file</div><div>/Yd put debug info in every .OBJ&nbsp; &nbsp; &nbsp; &nbsp; /Yl[sym] inject .PCH ref for debug lib</div><div>/Yu[file] use .PCH file&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/Y- disable all PCH options</div><div>/Zm&lt;n&gt; max memory alloc (% of default)&nbsp; /FS force to use MSPDBSRV.EXE</div><div>/await enable resumable functions extension</div><div>/Wv:xx[.yy[.zzzzz]] disable warnings introduced after version xx.yy.zzzzz</div><div>/source-charset:&lt;iana-name&gt;|.nnnn set source character set</div><div>/execution-charset:&lt;iana-name&gt;|.nnnn set execution character set</div><div>/utf-8 set source and execution character set to UTF-8</div><div>/validate-charset[-] validate UTF-8 files for only legal characters</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -LINKING-</div><div></div><div>/LD Create .DLL&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/LDd Create .DLL debug library</div><div>/LN Create a .netmodule&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/F&lt;num&gt; set stack size</div><div>/link [linker options and libraries]&nbsp; &nbsp; /MD link with MSVCRT.LIB</div><div>/MT link with LIBCMT.LIB&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /MDd link with MSVCRTD.LIB debug lib</div><div>/MTd link with LIBCMTD.LIB debug lib&nbsp; &nbsp;&nbsp;</div><div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -CODE ANALYSIS-</div><div></div><div>/analyze[-] Enable native analysis&nbsp; &nbsp; &nbsp; /analyze:quiet[-] No warning to console</div><div>/analyze:log&lt;name&gt; Warnings to file&nbsp; &nbsp; &nbsp;/analyze:autolog Log to *.pftlog</div><div>/analyze:autolog:ext&lt;ext&gt; Log to *.&lt;ext&gt;/analyze:autolog- No log file</div><div>/analyze:WX- Warnings not fatal&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/analyze:stacksize&lt;num&gt; Max stack frame</div><div>/analyze:max_paths&lt;num&gt; Max paths&nbsp; &nbsp; &nbsp; &nbsp;/analyze:only Analyze, no code gen</div><div></div><img src ="http://www.cppblog.com/hkingSP/aggbug/216292.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/hkingSP/" target="_blank">宋鹏</a> 2019-03-09 11:23 <a href="http://www.cppblog.com/hkingSP/archive/2019/03/09/216292.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>