In addition to man gcc
which should be the first stop for questions about any command, you can also try the almost standard --help
option. Even for commands that don't support it, an unsupported option usually causes it to print an error containing usage information that should hint at a similar option. In this case, gcc will display a terse (for gcc, its only about 50 lines long) help summary listing the small number of options that are understood by the gcc program itself rather than passed on to its component programs. After the description of the --help
option itself, it lists --target-help
and -v --help
as ways to get more information about the target architecture and the component programs.
My MinGW GCC 3.4.5 installation generates more than 1200 lines of output from gcc -v --help
on Windows XP. I'm pretty sure that doesn't get much smaller in other installations.
It would also be a good idea to read the official manual for GCC. It is also helpful to read the documentation for the linker (ld
) and assembler (often gas
or just as
, but it may be some platform specific assembler as well); aside from a platform-specific assembler, these are documented as part of the binutils
collection.
General familiarity with the command line style of Unix tools is also helpful. The idea that a single-character option's value might not be delimited from the option name is a convention that goes back essentially as far as Unix does. The modern convention (promulgated by GNU) that multiple-character option names are introduced by --
instead of just -
implies that -lm
might be a synonym for -l m
(or the pair of options -l -m
in some conventions but that happens not to be the case for gcc
) but it is probably not a single option named -lm
. You will see a similar pattern with the -f
options that control specific optimizations or the -W
options that control warnings, for example.