Next: , Previous: GNU Free Documentation License, Up: Top

1 Invoking gccgo

The gccgo command is a frontend to gcc and supports many of the same options. See Option Summary. This manual only documents the options specific to gccgo.

The gccgo 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.

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 gccgo. A single invocation of gccgo may only compile a single package.

One Go package may import a different Go package. The imported package must have already been compiled; gccgo 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.

Specify a directory to use when searching for an import package at compile time.
When linking, specify a library search directory, as with gcc.
Go permits a single program to include more than one package with the same name. This option is required to make this work with gccgo. The argument to this option may be any string. Each package with the same name must use a distinct -fgo-prefix option. The argument is typically the full path under which the package will be installed, as that must obviously be unique.
By default gccgo will warn about functions which have one or more return parameters but lack an explicit return statement. This warning may be disabled using -fno-require-return-statement.