Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>compiler and linker switches</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                        Compiler and Linker Switches

    The behavior of the compiler MSC and the linker MS-LINK are defined
    by one or more command-line arguments (or switches) that have the
    general form /XXX, where XXX is a string of one or more letters and
    digits. The compiler switches can be broken into seven functional
    categories:

                Memory Models
                Code Generation
                Preprocessor
                Optimizer
                Files
                Language
                Miscellaneous

    In addition, the Linker has two switches of its own.

       Note:    The case of the compiler options is significant: if there
                were a switch /UPPER, for example, it would not be
                properly recognized if you typed /upper.

                /HELP (and /help) is a special switch: it causes a
                summary of the command-line switches to be displayed on
                the console.

  -------------------------- Memory Model Switches --------------------------

         /Am    where m is one of S, C, M, L or H to represent the small,
                compact, medium, large and huge models, respectively.

  ---------------------- Code Generation Switches --------------------------

         /Gn    where n 0, 1 or 2 to represent 8086, 80186 or 80286
                instructions, respectively.

         /Gc    Generate MS-Pascal and MS-Fortran style function calls.

         /Gs    Disable stack probe checking. This affects the #pragma
                check_stack.

      /Gt[n]    Use with compact, large and huge memory models to create
                new data segments based on the object size n. If n is
                omitted it defaults to 256.

  ------------------------- Preprocessor Switches---------------------------

          /C    Don't remove comments from the source file.

         /Dname[=macro-def]
                Define a macro name with a value (no arguments).

          /E    Preprocess the source to stdout.

         /EP    Combines /E and /P but no #line directives are written
                out.

      /Ipath    Specify a header #include path.

          /P    Preprocess the source to a file of the same name with
                type .I.

      /Uname    Remove a predefined macro definition.

          /u    Remove all predefined macro definitions.

          /X    Do not search the standard places when looking for
                headers.

  ------------------------ Floating Point Switches -------------------------

        /FPi    Generate inline code and use the Floating Point emulator
                (default).

        /FPc    Generate calls and use the FP emulator.

      /FPc87    Generate calls and use the 8087 library.

      /FPi87    Generate inline code and use the 8087.

        /FPa    Generate calls and use the alternate math library.

  -------------------------- Optimizer Switches ----------------------------

         /Oa    Relax alias checking.

         /Od    Disable optimization.

         /Os    Optimize for code size.

         /Ot    Optimize for execution speed.

         /Ox    Maximize optimization. (Equivalent to using /Oas /Gs)

  ----------------------------- File Switches ------------------------------

         /Fa[assembly-list-file]
                Specify the name of the assembly listing file. The file
                type defaults to .ASM.

         /Fc[object+source-list-file]
                Specify the name of the object/source listing file. The
                file type defaults to .COD.

         /Fe[executable-file-name]
                Specify the name of the executable file. The file type
                defaults to .EXE.

         /Fl[object-list-file]
                Specify the name of the object listing file. The file
                type defaults to .COD.

         /Fm[map-file-name]
                Specify the name of the executable file. The file type
                defaults to .EXE.

         /Fo[object-file]
                Names the object file to be created by the compiler. The
                default file type is .OBJ.

         /Fs[source-list-file]
                Names the source listing file. The default file type is
                .LST.

  --------------------------- Language Switches ----------------------------

         /Za    Disable recognition of MS-C keywords near, far, huge,
                cdecl, fortran and pascal. Defines the macro NO_EXT_KEYS.

         /Zd    Place line number records in the object file for use by
                SYMDEB.

         /Ze    Enable recognition of MS-C keywords near, far, huge,
                cdecl, fortran and pascal. This is the default.

         /Zg    Build a function call prototype from each function
                definition in the source file. The output is written to
                stdout.

         /Zi    Generate debugging information in the object file for
                CodeView.

         /Zl    Suppresses the selection of the default libraries.

         /Zs    Perform a syntax check only; do not generate object code.

         /Zp    Align structures on byte (instead of word) boundaries.

  ------------------------ Miscellaneous Switches --------------------------

          /c    Compile only--do not invoke MS-LINK.

         /Hn    Set length of significance of external names to n. The
                default is 31 characters.

          /J    Set the default char type to be unsigned. The default is
                signed.

    /V"text"    Imbed the text string in the object file.

         /Wn    Set the warning level to n (warnings indicate potential
                problems, rather than actual errors):

                 n =          Warn About

                  0      Nothing (suppress all warnings)
                  1      Unsafe conversions and overt type mismatches
                  2      Automatic data conversions and missing returns
                         in functions
                  3      Currently equivalent to /W2

                The default is level 1.

          /w    A shorthand method of specifying /W0.


  --------------------------- Linker Switches ------------------------------

/NOIGNORECASE   Treats the casing of external names as significant.

    /STACK:n    Set the run-time stack size size to n bytes. (The run-
                time stack is used heavily by auto variables.)  EXEMOD
                can also be used to change a program's stack size.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson