แก้ไข

แชร์ผ่าน


/U, /u (Undefine symbols)

The /U compiler option undefines the specified preprocessor symbol. The /u compiler option undefines the Microsoft-specific symbols that the compiler defines.

Syntax

/U[ ]symbol
/u

Arguments

symbol
The preprocessor symbol to undefine.

Remarks

Neither of the /U and /u options can undefine a symbol created by using the #define directive.

The /U option can undefine a symbol that was previously defined by using the /D option.

By default, the compiler may define a large number of Microsoft-specific symbols. Here are a few common ones:

Symbol Function
_CHAR_UNSIGNED Default char type is unsigned. Defined when the /J option is specified.
_CPPRTTI Defined for code compiled with the /GR option.
_CPPUNWIND Defined for code compiled with the /EHsc option.
_DLL Defined when the /MD option is specified.
_M_IX86 By default, defined to 600 for x86 targets.
_MSC_VER Defined as a unique integer value for each compiler version. For more information, see Predefined macros.
_WIN32 Defined for WIN32 applications. Always defined.
_MT Defined when the /MD or /MT option is specified.

For a complete list of Microsoft-specific predefined macros, see Predefined macros.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > C/C++ > Advanced property page.

  3. Modify the Undefine Preprocessor Definitions or Undefine All Preprocessor Definitions properties.

To set this compiler option programmatically

See also

MSVC compiler options
MSVC compiler command-line syntax
/J (Default char type is unsigned)
/GR (Enable run-time type information)
/EH (Exception handling model)
/MD, /MT, /LD (Use run-time library)