<html lang="en"> <head> <title>Invoking gccgo - The GNU Go Compiler</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="The GNU Go Compiler"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="prev" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License" title="GNU Free Documentation License"> <link rel="next" href="Import-and-Export.html#Import-and-Export" title="Import and Export"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 2010 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled ``GNU Free Documentation License''. (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Invoking-gccgo"></a> <p> Next: <a rel="next" accesskey="n" href="Import-and-Export.html#Import-and-Export">Import and Export</a>, Previous: <a rel="previous" accesskey="p" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> <hr> </div> <h2 class="chapter">1 Invoking gccgo</h2> <!-- man title gccgo A GCC-based compiler for the Go language --> <!-- man begin DESCRIPTION gccgo --> <p>The <samp><span class="command">gccgo</span></samp> command is a frontend to <samp><span class="command">gcc</span></samp> and supports many of the same options. See <a href="../gcc/Option-Summary.html#Option-Summary">Option Summary</a>. This manual only documents the options specific to <samp><span class="command">gccgo</span></samp>. <p>The <samp><span class="command">gccgo</span></samp> command may be used to compile Go source code into an object file, link a collection of object files together, or do both in sequence. <p>Go source code is compiled as packages. A package consists of one or more Go source files. All the files in a single package must be compiled together, by passing all the files as arguments to <samp><span class="command">gccgo</span></samp>. A single invocation of <samp><span class="command">gccgo</span></samp> may only compile a single package. <p>One Go package may <code>import</code> a different Go package. The imported package must have already been compiled; <samp><span class="command">gccgo</span></samp> will read the import data directly from the compiled package. When this package is later linked, the compiled form of the package must be included in the link command. <!-- man end --> <!-- man begin OPTIONS gccgo --> <dl> <dt><code>-I</code><var>dir</var><dd><a name="index-g_t_0040option_007b_002dI_007d-2"></a>Specify a directory to use when searching for an import package at compile time. <br><dt><code>-L</code><var>dir</var><dd><a name="index-g_t_0040option_007b_002dL_007d-3"></a>When linking, specify a library search directory, as with <samp><span class="command">gcc</span></samp>. <br><dt><code>-fgo-prefix=</code><var>string</var><dd><a name="index-g_t_0040option_007b_002dfgo_002dprefix_007d-4"></a>Go permits a single program to include more than one package with the same name. This option is required to make this work with <samp><span class="command">gccgo</span></samp>. The argument to this option may be any string. Each package with the same name must use a distinct <samp><span class="option">-fgo-prefix</span></samp> option. The argument is typically the full path under which the package will be installed, as that must obviously be unique. <br><dt><code>-frequire-return-statement</code><dt><code>-fno-require-return-statement</code><dd><a name="index-g_t_0040option_007b_002dfrequire_002dreturn_002dstatement_007d-5"></a><a name="index-g_t_0040option_007b_002dfno_002drequire_002dreturn_002dstatement_007d-6"></a>By default <samp><span class="command">gccgo</span></samp> will warn about functions which have one or more return parameters but lack an explicit <code>return</code> statement. This warning may be disabled using <samp><span class="option">-fno-require-return-statement</span></samp>. </dl> <!-- man end --> </body></html>