SYNOPSIS
cc
[
cxx
[
DESCRIPTION
The cc and cxx commands serve as interfaces to the Microsoft C compiler (cl). Versions 5.0 and higher of this compiler are supported. cc is for compiling C files, while cxx is for compiling C++ files.
- Note:
-
The behavior of cc depends upon whether or not you are working in the standard MKS Toolkit development environment or the development environment designed for use with the MKS Toolkit UNIX APIs.
cxx is only available in the PTC MKS Toolkit UNIX APIs development environment.
These commands are just wrappers that invoke the cl utility. If you are using PTC MKS Toolkit for Professional Developers or PTC MKS Toolkit for Developers, the presence of cl in PATH is checked for during installation. For other Toolkit products, you must ensure yourself that cl is in the PATH.
Files with a .c suffix are taken to be C source files, files with a .cpp or .cxx extension are taken to be C++ source files, and files with a .asm extension are taken to be assembly language source files. The presence of source files with a .cpp or .cxx automatically causes the source files to be compiled as if the cxx command had been invoked instead.
The cc and cxx commands implicitly set the following Microsoft compiler switches (for Intel platforms only):
/D_X86_ /D_NUTC_=0x430 (Value changes with each release) /Zl /Qifdiv-
- Note:
-
The
/D_NUTC_=0x430 option is only set when working in the PTC MKS Toolkit UNIX APIs development environment.The
/Qifdiv- option is only set when working in the PTC MKS Toolkit UNIX APIs development environment and is only available for Microsoft Visual Studio 2.1 or later.
You can use the
Options
-c -
compiles only — does not link.
This option becomes the
/c option to cl. -C -
passes comments through to preprocessor output.
This option becomes the
/C option to cl. -
-D name[= value] -
defines a preprocessor symbol with an optional value.
This option becomes the
/Dname=value option to cl. -E -
sends all preprocessor output to standard output.
This option becomes the
/E option to cl. -e epsym-
sets entry point (passed through to linker).
-f float-
specifies the floating point options that the compiler and linker use:
-f- no floating point required-f emulated floating point-fp hardware floating point (using 80x87 coprocessor)- Note:
-
This option is obsolete and produces a warning. It is provided for backward compatibility and is not available with cxx or when working in the PTC MKS Toolkit UNIX APIs development environment.
-g -
produces debugging information in the compiled object modules.
This option becomes the
/Z7 option to cl. -I directory-
adds directory to the beginning of the list of directories to be searched for include files (the value of the %Include% environment variable). Any directories supplied on the command line are searched first, in the order in which they appear on the command line.
This option becomes the
/Idirectory option to cl. -l library-
if linking, adds the specified library to the list of libraries to be searched. In searching for libraries (for example, with -lfoo), each library directory is first searched for the UNIX-style archive name (that is, libfoo.a) and then for the Windows-style library name (that is, foo.lib).
This option is passed through to the linker.
-L directory-
if linking, adds the directory to the beginning of the list of directories that the linker searches for libraries (the value of the %Lib% environment variable). Any directories supplied on the command line are searched first, in the order in which they appear on the command line.
This option is passed through to the linker.
-m -
produces a link map.
This option is passed through to the linker.
-m model-
specifies the memory model that the compiler and linker use. The models may include:
-ms small model-mm medium model-ml large model-mf flat model (32-bit)-mc compact model-mh huge model- Note:
-
This option is obsolete and produces a warning. It is provided for backward compatibility and is not available with cxx or when working in the PTC MKS Toolkit UNIX APIs development environment.
-M -
complains about multiply defined symbols.
- Note:
-
This behavior is only available when working in the PTC MKS Toolkit UNIX APIs development environment. Otherwise,
-M is identical to the-m option.
-o output-
specifies the name of the output file generated by the linker. This option is passed to the linker. If
-c and-o are both specified, the-o option is ignored; however, you can specify a name for the object file generated with-W/Fo obj_file.- Note:
-
When working in the PTC MKS Toolkit UNIX APIs development environment, the
-o option is not ignored. Instead, it behaves like-W/Fo obj_file and specifies the name of the object file generated.
File names specified with the
-W/Fo option should have a .o or .obj extension. If the file name does not have such an extension, its current extension is replaced with .obj before invoking the linker. However, when-c is also specified, there are no restrictions on the extension of the specified file. -O -
instructs the compiler to generate optimized code.
This option becomes the
/Ox option to cl. -P -
stores preprocessor output to a file, where the file name is obtained by replacing the .c (or .cpp) extension with .i.
-s -
when linking, strips debugging information from the output file.
This option is passed through to the linker.
-S -
produces an assembly code listing. The suffix for the listing file is .asm. This listing includes source and assembly code.
This option becomes the
/FAs option to cl. -static -
requests linking against the static C++ runtime libraries. This is not recommended.
When this option is not specified, the
/MD to cl is the default for C++ and multithreaded DLLs are produced. -u symname-
when linking, adds an undefined reference to symname.
This option is passed through to the linker.
-U symname-
undefines the specified preprocessor symbol.
This option becomes the
/Usymname option to cl. -VS num-
passes through to the
/VERSION linker option. -Wc++ -
forces C++ linking.
This option is passed through to the linker.
- Note:
-
The C++ library paths are only available when working in the development environment for the PTC MKS Toolkit UNIX APIs. If you are not working in this environment, you must specify these library paths with the
-L option.
-Wv -
selects verbose mode.
This option is passed through to the linker.
-W/ option-
specifies an option that is to be passed either to the C compiler or to linker with the leading
-W removed. The options — subsystem, def, base, entry, implib, machine, map, out, stack, and dll — are passed to the linker; all others are passed to the compiler. -x -
when linking, strips debugging information related to local symbols from the output file.
This option is passed through to the linker.
-Xc -
compiles with strict ANSI C conformance. Only symbols specified by the ANSI C specification are visible during compilation.
This option becomes the
/D__STRICT_ANSI=1 and/D__STDC__=1 options to cl. -Xa -Xs -Xt -
compiles with non-strict ANSI C conformance. Only symbols specified by the ANSI C specification are visible during compilation.
This option becomes the
/D__STDC__=0 to cl.
While this reference page describes cc as an interface to the Microsoft C compiler, that is not the complete truth. In truth, cc is a configurable interface to any C compiler and is designed for use with make. Theoretically, you can simply redefine cc on each system to work with that system's C compiler and by simply using cc in your makefiles, you can use those same makefile across different system.
cc uses a compilation configuration file to convert arguments on a standard command line into the arguments for the command or sequence of commands needed to call your compiler or linker. If you want to change your compiler or linker, change the appropriate configuration file; do not change your makefile.
The default configuration file for cc is
ROOTDIR/etc/compiler.ccg
You may chose a different configuration file by setting the environment variable CCG to point to the desired file. Interfaces to other compilers may be available from MKS.
If you want cc to temporarily use a different compiler, you can set the environment variable CCG to the name of the configuration file for the desired compiler.
If you rename the cc executable, it attempts to find its default configuration in a .ccg file with the same base name as the renamed executable. For example, if you rename cc.exe to c89.exe, c89 looks for a default configuration file named c89.ccg in ROOTDIR/etc.
If you use a compiler that does not have a configuration file, you can customize a given configuration file to use your compiler. Read the cc miscellaneous information reference page carefully, and modify an existing configuration to use your compiler.
ENVIRONMENT VARIABLES
- CCG
-
identifies the configuration file for the desired compiler. If CCG contains -, cc reads the default configuration from the standard input. If CCG contains a file name, cc uses that file as its default configuration file. If CCG contains a directory name, cc looks for the default configuration in the cc.ccg file in that directory. If the executable has been renamed, it looks for the default configuration in a .ccg file with the same name as the executable. For example, if cc.exe is renamed to c89.exe, it looks for the default configuration in $CCG/c89.ccg.
DIAGNOSTICS
Possible exit status values are:
NOTE
The cc utility, like many of the other compiler-related commands, actually launches an appropriate CCG script (see the cc miscellaneous reference page) to preprocess the options described before calling the Microsoft compiler to perform the actual compiler. The actual CCG script run is determined by the setting of the CCG environment variable (see ENVIRONMENT VARIABLES) which can vary depending on whether or not you're working in the NuTCRACKER Platform development environment.
To modify cc (for example, to work with a different compiler), you simply need to modify the CCG script that cc runs based on the setting of the CCG environment variable.
AVAILABILITY
The cc command is available with the following products:
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation
The cxx command is available with the following products:
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Miscellaneous:
- cc
PTC MKS Toolkit 10.5 Documentation Build 40.