Dev C Compiler Options

-->

The -define option defines name as a symbol in all source code files your program.

Nov 10, 2016  DEV-C supports GCC-based compilers, popular for its stability and the variety of languages they support. The compiler systems used in this IDE make it quite flexible. It utilizes the MinGW (Minimalist Graphics User Interface) for Windows, which uses GCC, as well as Cygwin, as an alternative option.

Dev

Syntax

Arguments

Visual C++ Compiler Options

name, name2
The name of one or more symbols that you want to define.

Remarks

The -define option has the same effect as using a #define preprocessor directive except that the compiler option is in effect for all files in the project. A symbol remains defined in a source file until an #undef directive in the source file removes the definition. When you use the -define option, an #undef directive in one file has no effect on other source code files in the project.

You can use symbols created by this option with #if, #else, #elif, and #endif to compile source files conditionally.

G++ Compiler Options

-d is the short form of -define.

You can define multiple symbols with -define by using a semicolon or comma to separate symbol names. For example:

Free

The C# compiler itself defines no symbols or macros that you can use in your source code; all symbol definitions must be user-defined.

Note

The C# #define does not allow a symbol to be given a value, as in languages such as C++. For example, #define cannot be used to create a macro or to define a constant. If you need to define a constant, use an enum variable. If you want to create a C++ style macro, consider alternatives such as generics. Since macros are notoriously error-prone, C# disallows their use but provides safer alternatives.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page.

  2. On the Build tab, type the symbol that is to be defined in the Conditional compilation symbols box. For example, if you are using the code example that follows, just type xx into the text box.

Dev C Compiler Options

For information on how to set this compiler option programmatically, see DefineConstants.

Example

See also