⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cc.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>cc</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_000_286">&nbsp;</a>NAME</h4><blockquote>cc - a C-language compilation system (<b><a href="intro.html#tag_001_003_003">LEGACY</a></b>)</blockquote><h4><a name = "tag_000_000_287">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>cc <b>[</b>-c<b>][</b>-C<b>][</b>-e <i>epsym</i><b>] [</b>-D <i>name</i><b>[</b>=value<b>]]</b>... <b>[</b>-E<b>][</b>-f<b>][</b>-F<b>][</b>-g<b>][</b>-I <i>directory</i><b>]</b>... <b>[</b>-L <i>directory</i><b>]</b>... <b>[</b>-o <i>outfile</i><b>][</b>-O<b>][</b>-p<b>][</b>-P<b>][</b>-q<b>][</b>-r<b>][</b>-s<b>][</b>-S<b>][</b>-u <i>symname</i><b>]</b>... <b>[</b>-U <i>name</i><b>]</b>... <b>[</b>-W <i>options</i><b>]</b>... <i>operand</i>...</code></pre></blockquote><h4><a name = "tag_000_000_288">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>cc</i>utility is an interface to an unspecified C-language compilation system.The system conceptually consists of a preprocessor,compiler, optimiser, assembler and link editor.The<i>cc</i>utility processes the supplied options and then executesthe various tools with the appropriate arguments.<p>The suffix of the pathname versions of an<i>operand</i>indicates how it is to be treated.See the OPERANDS section.<p>The files referenced by<i>operand</i>swill be compiled/assembled andlinked to produce an executable file.(It is unspecified whether the linking occursentirely within the operation of<i>cc</i>;some systems may produce objects that arenot fully resolved until the file is executed.)<p>If the<b>-c</b>option is specified,for all pathname operands of the form<i>file</i><b>.c</b>the files:<pre><code>$(basename <i>pathname</i> .c).o</code></pre>will be created as the result of successful compilation.Similar results occur for pathname operands of the form<i>file</i><b>.i</b>and<b>.s</b>.If the<b>-c</b>option is not specified,it is unspecified whether such<b>.o</b>files are created or deleted for these operands.<p>If there are no options that prevent link editing (such as<b>-c</b>or<b>-E</b>),and all operands compile andlink without error, the resulting executable file will bewritten according to the<b>-o</b>&nbsp;<i>outfile</i>option (if present) or to the file<b>a.out</b>.<p>The executable file will be created as specified in the <b>XSH</b> specification,except that the file permissions will be set to:<pre><dl compact><dt> <dd>S_IRWXO | S_IRWXG | S_IRWXU</dl></pre>and that the bitsspecified by the<i>umask</i>of the process will be cleared.</blockquote><h4><a name = "tag_000_000_289">&nbsp;</a>OPTIONS</h4><blockquote>The<i>cc</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> , except that:<ul><p><li>The<b>-l</b>&nbsp;<i>library</i>operands have the format of options, but their positionwithin a list of operands affects the order in which librariesare searched.<p><li>The order of specifying the<b>-I</b>and<b>-L</b>options is significant.<p><li>Portable applications must specifyeach option separately; that is, grouping option letters(for example,<b>-cO</b>)need not be recognised by all implementations.<p></ul><p>The following options are supported:<dl compact><dt><b>-c</b><dd>Suppress the link-edit phase of the compilation, anddo not remove any object files that are produced.<dt><b>-E</b><dd>Run only the preprocessoron the named C-language programs and send the result to standard output.<dt><b>-f</b><dd>Include floating-point support for systems without an automaticallyincluded floating point implementation.This option is ignored on systems that do not need it.<dt><b>-F</b><dd>This option is reserved for implementation-dependentoptimisation directives.<dt><b>-g</b><dd>Cause the compilerto generate additional informationneeded for use by a debugger (possibly<i>sdb</i>).<dt><b>-o&nbsp;</b><i>outfile</i><dd>Use the name<i>outfile</i>instead of the default<b>a.out</b>for the executable file produced.This is a link-edit option.<dt><b>-O</b><dd>Do compilation phase optimisation.This option will not affect<b>.s</b>files.<dt><b>-p</b><dd>This option is reserved for invoking implementation-dependentprofiling procedures.<dt><b>-P</b><dd>Run only the preprocessoron the named C-language programs and leave the resulton corresponding files suffixed<b>.i</b>.<dt><b>-q</b><dd>This option is reserved for specifying implementation-dependentprofiling directives.<dt><b>-S</b><dd>Compile and do not assemble the named C-language programs, and leave theassembler-language output on corresponding files suffixed.s.<dt><b>-W</b> <i>c</i>,<i>arg</i><b>[</b>,<i>arg</i> ...<b>]</b><dd>Pass the arguments<i>arg</i>to phase<i>c</i>where<i>c</i>is one of[p02al]indicating preprocessing, compiling, optimising, assemblingor link editing phases, respectively.For example,<b>-Wa,-m</b>passes<b>-m</b>to the assembler phase.</dl><p>The<i>cc</i>utilityalso recognises a number of options that it will pass(with their associated arguments)directly to another phase of the<i>cc</i>utility.The use of the<b>-W</b>option is not required for these options.<p>The following options are passed by<i>cc</i>(with their associated arguments)to the preprocessor phase:<dl compact><dt><b>-C</b><dd>By default, the preprocessor strips C-language style comments.If the<b>-C</b>option is specified, all comments(except those found on preprocessor directive lines)are passed along.<dt><b>-D</b><i> name</i><b>[=</b><i>value</i><b>]</b><dd>Define<i>name</i>as if by a C-language<b>#define</b>directive.If no<i>=value</i>is given,a value of 1 will be used.The<b>-D</b>option has lower precedence than the<b>-U</b>option.That is, if<i>name</i>is used in both a<b>-U</b>and a<b>-D</b>option,<i>name</i>will be undefined regardless of the order of the options.Additional implementation-dependent<i>names</i>may be provided by the compiler.Implementations support at least 2048 bytes of<b>-D</b>definitionsand 256<i>names</i>.<dt><b>-I&nbsp;</b><i>directory</i><dd>Change the algorithm for searching for headerswhose namesare not absolute pathnamesto look in the directory named by the<i>directory</i>pathname before looking in the usual places.Thus, headerswhose names are enclosed in double-quotes (<b>""</b>)will be searched for first inthe directory of the file with the<b>#include</b>line,then in directoriesnamed in<b>-I</b>options, and last in theusual places.For headerswhose names are enclosed inangle brackets(&lt;&gt;),the header will be searched for onlyin directories named in<b>-I</b>options and then in theusual places.Directories named in<b>-I</b>options will be searchedin the order specified.Implementations support at least teninstances of this option in a single<i>cc</i>command invocation.<dt><b>-U&nbsp;</b><i>name</i><dd>Remove any initial definition of<i>name</i>,where<i>name</i>is a reserved symbol that is predefinedby the particular preprocessor.</dl><p>The following options are passed by<i>cc</i>(with their associated arguments)to the link-edit phase:<dl compact><dt><b>-e&nbsp;</b><i>epsym</i><dd>Set the default entry point address for the output fileto be that of the symbol<i>epsym</i>.<dt><b>-L&nbsp;</b><i>dir</i><dd>Change the algorithm of searching for the libraries named in the<b>-l</b>objects to look in the directory namedby the<i>directory</i>pathname before looking in theusual places.Directories named in<b>-L</b>options will be searched in the order specified.Implementations support at least teninstances of this option in a single<i>cc</i>command invocation.If a directory specified by a<b>-L</b>option contains files named<b>libc.a</b>,<b>libm.a</b>,<b>libl.a</b>,or<b>liby.a</b>,the results are unspecified.This option is only effective if it precedes the<b>-l</b>option on the command line.<dt><b>-r</b><dd>Retain relocation entries in the output object file.Relocation entries must be saved if the output isto become the input of a subsequent<i>cc</i>run.The link-edit phase will not complainabout unresolved references and will not makethe object output executable.<dt><b>-s</b><dd>Produce object or executable files, or both, from whichsymbolic and other information not required for properexecution using the <b>XSH</b> specification<i>exec</i>family has been removed (stripped).If both<b>-g</b>and<b>-s</b>options are present, the action taken is unspecified.<dt><b>-u&nbsp;</b><i>symname</i><dd>Enter<i>symname</i>as an undefined symbol into the symbol table.This is useful for loading entirely from a library,since initially the symbol table is emptyand an unresolved reference is needed toforce loading of the first routine.</dl></blockquote><h4><a name = "tag_000_000_290">&nbsp;</a>OPERANDS</h4><blockquote>An<i>operand</i>is either in the form of a pathname or the form<b>-l</b>&nbsp;<i>library</i>.At least one operand of the pathname form must be specified.The following operands are supported:<dl compact><dt><i>file.</i><b>c</b><dd>A C-language source file that may be preprocessed,compiled, optimised and link edited.<dt><i>file.</i><b>i</b><dd>A C-language source file that has been preprocessed,and may be compiled, optimised and link edited.<dt><i>file.</i><b>s</b><dd>An assembly language source file that may be assembledand link edited.<dt><i>file.</i><b>a</b><dd>A library of object files typically produced by the<i><a href="ar.html">ar</a></i>utility,and passed directly to the link editor.</dl><p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -