Index of Section 1 Manual Pages

Interix / SUAc89.1Interix / SUA

C89(1)                  System General Commands Manual                  C89(1)

NAME
     c89, cc, wcc - compiler interface to MSVC

SYNOPSIS
     c89 [-cEgMPSsu] [-B linkspec] [-D name [=value ...]] [-I directory ...]
         [-L directory ...] [-n type] [-N nostdlib|nostdinc|nostdc|stdc]
         [-o outfile] [-O1 | -O2 | -O3 | -Os] [-U name] [-X CL_options]
         [-Y LINK_options ...] operand ...
     cc [-cEgMPSsu] [-B linkspec] [-D name [=value ...]] [-I directory ...]
         [-L directory ...] [-M] [-n type] [-N nostdlib|nostdinc|nostdc|stdc]
         [-o outfile] [-O1 | -O2 | -O3 | -Os] [-U name] [-X CL_options]
         [-Y LINK_options ...] operand ...
     wcc [-cEgMPSsu] [-B linkspec] [-D name [=value ...]] [-I directory ...]
         [-L directory ...] [-M] [-n type] [-N nostdlib|nostdinc|nostdc|stdc]
         [-o outfile] [-O1 | -O2 | -O3 | -Os] [-U name] [-X CL_options]
         [-Y LINK_options ...] operand ...

DESCRIPTION
     The utilities c89, cc and wcc are a shell script interface to the system
     C compiler (in this case, the Microsoft Visual C/C++ compiler; aka
     MSVC).The operands are either the names of files to be compiled or linked
     (in which case they will have the file extensions .c or .obj), or they
     indicate libraries containing modules to be linked (in which case they
     will begin with the -l prefix). For brevity throughout this manual page
     whenever c89 is mentioned the same information will usually be true for
     cc and wcc also. Where information may vary then cc and wcc will be men-
     tioned directly.

     The c89 utility can be invoked as cc.  If invoked as cc, it behaves dif-
     ferently in the following ways:
           o  -L and -o become operands, not options: they can be in any posi-
              tion in the command line. When invoked as c89, the -L and -o
              arguments are options and must come before any operands. In c89,
              the libraries are operands, not options (even though they begin
              with `l'), and must be placed at the end of the command line.
           o  The option -D unix is passed, so the macro unix is defined.
           o  Compiler extensions to the ANSI C standard (such as additional
              keywords) are allowed. ( c89 does not allow extensions.)

     The c89 utility can be invoked as wcc too. When this happens the default
     is to produce binary or object files for Windows "console" rather than
     for Interix. The `W' in wcc stands for "Windows". Refer to the -n option
     for adjustments for the selection of object or binary types.

OPTIONS
     The c89, cc and wcc utilities accept the following options:

     -B linkspec
             Use the GNU linker, ld(1), instead of the Visual C linker. If the
             argument linkspec is dynamic, the binary will be dynamically
             linked.  If it is static, the binary will be statically linked
             (using LINK.EXE).  If the argument is dll, the compiler will link
             to libc.dll to expose functionality as an Interix/SUA DLL. Refer
             to the -G option for more details on creating DLL's.

     -c      Compile but do not link, and do not remove any object files.

     -D name[=value]
             Define name as if the #define keyword had been used. If a value
             is given, it is assigned to name; otherwise, name has a value of
             1. You can specify more than one -D option.

     -E      Expand all C preprocessor directives and copy the C source files
             to standard output.

     -f PIC | pic
             An interopability option for makefile and building scripts that
             is a no-op.  No warning is given during the compile that this is
             a no-op.  Useful with existing or autogenerated build instruc-
             tions.

     -f XXX  An interoperability option where 'XXX' stands for anything.  A
             warning is given during the compile that the operand is being
             ignored.  Useful with existing or autogenerated build instruc-
             tions.

     -g      Produce symbolic information in the object or executable files.

     -G      Create an Interix .dll file that exposes POSIX functionality to
             other Windows process. Use in conjunction with the -B dll flag.
             Only valid for Interix release 5.2 and later.

     -I directory
             Search directory for header files before looking in the usual
             places.  You can specify more than one -I option.

     -L Directory
             Search directory for library files before looking in the usual
             places.  You can specify more than one -L option. The paths spec-
             ified using this option are combined to set the LIB environment
             variable before LINK.EXE is executed.

     -m x86 | amd64 | ia64
             Used to enable cross-compilation of 32-bit applications on 64-bit
             platforms (and vice versa when possible). Note that on a 32-bit
             platform, x86 is the Similar for ia64.  default, and on a 64-bit
             platform, amd64 is the default.  The two options are mutually
             exclusive.  It is suggested that when using this flag, either the
             C89_COMPILER or C89_LINKER environment variable should be set to
             point to the correct compiler binary.
             For example, to compile an x86 binary on an AMD64 machine:
                   c89 -m x86 hello.c

     -M      Produce a linker map file. This option has no effect if you also
             specified -c, -E, or -P.

     -n type
             Specify the type of object or binary to be created. The type
             argument can be one of:
                   interix  Create an Interix binary or object.
                   windows  Create a Windows (possibly GUI) binary or object.
                   dll      Create a Windows DLL object (different than the -G
                            and -B options).
                   console  Create a Windows console (non-GUI) object or
                            binary.

     -N type
             Enable or disable automatic inclusion of certain files, depending
             upon the value of type:
                   nostdc    Disable ANSI-only mode in the Visual C++ compiler
                             and allows use of Microsoft extensions. By
                             default, the compiler is run in ANSI C mode.
                             NOTE: you must use this option when linking with
                             ODBC headers (e.g. sqltypes.h) because the head-
                             ers shipped with MSVC are not ANSI-based files.
                   nostdinc  Disable automatic inclusion of standard header
                             files.
                   nostdlib  Disable automatic inclusion of standard library
                             files.
                   nostdlibdir
                             Do not search the standard directories for
                             library files.
                   stdc      Enable ANSI-only mode in the Visual C++ compiler.
                             This is the default.

     -o outfile
             Use the path name outfile instead of the default name a.out. This
             option cannot be used with -c.

     -O1 | -O2 | -O3 | -Os
             Optimize the code that is generated for the output file. Three
             levels, -O1, -O2 and -Os are supported. The option -O3 is mapped
             to for compatability. The option -O1 is optimize for space while
             -O2 is optimize for speed. The option -Os hints that space is the
             consideration during code optimization.

     -p filename
             Use filename for the name of the ".PDB" file instead of the
             default. For use with the -b option.

     -P      Preprocess the C source file and write the results to a file with
             a .i extension in place of .c.

     -R      Create a "mixed-mode" binary. A mixed-mode binary can make API
             calls to both the Interix subsystem and libraries as well as the
             Windows subsystem and libraries/DLL's.

     -S      Create an assembler listing; the format and file extension depend
             upon the underlying compiler.

     -s      Strip symbolic names and other extraneous information from the
             object file or executable. Note that Windows binaries typically
             keep symbolic and debugging information not in the object or exe-
             cutable file, but is kept in a ".PDB" file. Hence, this option is
             mostly available for interoperability of makefiles and building
             scripts.

     -U name
             Undefine name as if the #undef keyword had been used. This takes
             precedence over any -D options given on the command line.

     -u      Undefine all of the pre-defined macros.

     -W opt  For interoperability with other compilers that use -W to set
             warning levels during compilation. When a version of MSVC that
             supports `/Wall' is used then opt will be treated as "all". Help-
             ful with makefiles and building script already existing or auto-
             matically generated.

     -X CL_options
             Passes the specified CL_options directly to the CL.EXE program.

     -Y LINK_options
             Passes the specified LINK_options directly to the LINK.EXE pro-
             gram.

     The only optimization options allowed are -O1 and -O2, both of which
     invoke the `/O2' option of the Microsoft Visual C compiler.

     Libraries can also be specified by using the correct operand; for exam-
     ple, -l m specifies the math library. (For compatibility with older sys-
     tems, the space between the -l and the library specifier is not
     required.) The order of operands is important; libraries are searched in
     the order they appear on the command line.

     The c89 utility understands the following -l library operands:
           -l c
                Include the standard C library. When the linker is invoked,
                this library is opened last.
           -l l
                Include the lex(1) library.
           -l m
                Include the math library.
           -l y
                Include the yacc(1) library.

     The c89 utility knows the default locations of the header files and the
     libraries, normally /usr/include and /usr/lib. It also knows about the
     default libraries, and includes them in the correct order.

     This implementation defines the following macros to be 1: _POSIX_ and
     __INTERIX.  When invoked as cc it also defines unix.

FILES
     The c89(1) utility makes use of the following files:
           libc.a    Interix implementations of C run-time functions. This is
                     placed before libcpsx.a so the Interix implementations of
                     functions are picked up.
           libcpsx.a
                     Microsoft Visual C/C++ C run-time library for POSIX.
           psxdll.a  Interix POSIX subsystem entry points. This normally comes
                     last in the command line.
           psxrtl.a  C run-time startup code. This is placed before libcpsx.a
                     in the final command line.

ENVIRONMENT VARIABLES
     The c89 utility makes use of the following environment variables, if set:
           C89_COMPILER
                     The compiler's complete path name. Case is significant
                     (for example, /dev/fs/C/MSVC40/BIN/CL.EXE). Useful if you
                     do not want to include /dev/fs/C/MSVC40/BIN in your PATH.
           C89_ECHO  If this variable is set to 1, c89 displays the command
                     lines it executes to run the compiler and linker.
           C89_LINKER
                     The linker's complete path name. Case is significant (for
                     example, /dev/fs/C/MSVC40/BIN/LINK.EXE). Useful if you do
                     not want to include /dev/fs/C/MSVC40/BIN in your PATH.
           _MSC_VER  This is defined to the major number release of the MSVC
                     compiler used.  This can be useful for conditionalizing
                     source code on available functionality (such as ISO C
                     1999).

DIAGNOSTICS
     The c89 utility exits with a value of 0 when successful and a value >0
     otherwise.

NOTES
     These interfaces work with the Microsoft Visual C/C++ compiler, not with
     gcc.

     This implementation of c89 is an interface to the Microsoft Visual C++
     compiler (CL.EXE) and linker (LINK.EXE). For this reason, it relies on
     the Windows-based compiler and linker for certain file operations,
     including locating files referenced in build scripts. Like other Win-
     dows-based applications, CL.EXE and LINK.EXE are not case sensitive, that
     is, they do not distinguish among file names based on case alone.  Conse-
     quently, Interix build scripts will fail if they reference files whose
     names differ only by case. For example, if an Interix build script refer-
     ences "myheader.h" and "MyHeader.h", the compiler treats both references
     as if they were to the same file, even though both files exist in the
     same directory. The only work around for this is to rename files whose
     names differ only by case.

     Because those programs do not understand the POSIX file name format, c89
     explicitly unsets the INCLUDE and LIB environment variables before run-
     ning. To search other directories for header files and libraries, use the
     -I and -L options, respectively.

     When LINK.EXE runs, it searches the following locations for library
     files, in this order:
           1. The current working directory.
           2. Paths specified using the Link and LIBPATH options. For more
              information on passing options to the Windows linker, see the
              description of the -X and -Y option earlier in this topic.
           3. The LIB environment variable. Before LINK.EXE is executed, the
              LIB environment variable is unset and then set using paths spec-
              ified using the -L option.

     The following file extensions are valid in operands:
           .a        Library file.
           .c        C source file.
           .lib      Library file.
           .o        Object file.
           .obj      Object file.
           .cpp      C++ source file.
           .C        C++ source file (note the extention is capitalized).

     Many different attempt are made to find the CL.EXE and LINK.EXE programs.
     If information from the environment varaibles cannot help in finding
     these programs then a probe of the registry is attempted for different
     versions of the Visual Studio suite starting with the most recent release
     and then proceeding to successively older releases. If the location of
     the programs is still not found then "well known" paths will be tested.

     For documention about the C++ libraries (e.g.libstdc++) please refer to
     the MSDN C++ documention available on the Internet at:
     http://msdn2.microsoft.com/en-us/library/52cs05fz

SEE ALSO
     gcc(1), ld(1)

Interix                       September 23, 2007                       Interix

Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA