The /Za compiler option disables and emits errors for Microsoft extensions to C that aren't compatible with ANSI C89/ISO C90. The deprecated /Ze compiler option enables Microsoft extensions. Microsoft extensions are enabled by default.
Syntax
/Za
/Ze
- This happens because declaring variables inside a for loop wasn't valid C until C99(which is the standard of C published in 1999), you can either declare your counter outside the for as pointed out by others or use the -std=c99 flag to tell the compiler explicitly that you're using this standard and it should interpret it as such.
- Nov 03, 2006 Error: 'for' loop initial declaration used outside c99 mode What is it and how can i solve it? You're coming to C from a Java background, aren't you? This is illegal in most C dialects; it is a legal C declaration, and so may be accepted if you are compiling C with a C compiler: Unless you severely hobble your C, that is not generally possible.
- Jan 14, 2017 Dev-C (int, char)نوشتن افاده کننده ها for در داخل.
Remarks
Note
Nov 25, 2016 Error 'for' loop initial declarations are only allowed in C99 or C11 mode - Duration: 0:53. T aha 3,096 views. How to change mode c98 into mode c11 in Dev-C - Duration: 2:10. Error: ‘for’ loop initial declarations are only allowed in C99 mode for(int i = 0; i c99 or -std=gnu99 to compile your code Now my question is this how to use the above option and enable c99 and c11?
The use of /Za when code is compiled as C++ is not recommended. The /Ze option is deprecated because its behavior is on by default. For a list of deprecated compiler options, see Deprecated and removed compiler options.
The Microsoft C/C++ compiler supports compilation of C code in two ways:
The compiler uses C compilation mode by default when a source file has a .c extension, or when the /Tc or /TC option is specified. The C compiler is an C89/C90 compiler that, by default, enables Microsoft extensions to the C language. For more information about specific extensions, see Microsoft Extensions to C and C++. When both C compilation and the /Za option are specified, the C compiler conforms strictly to the C89/C90 standard. The compiler treats Microsoft extended keywords as simple identifiers, disables the other Microsoft extensions, and automatically defines the __STDC__ predefined macro for C programs.
The compiler can compile C code in C++ compilation mode. This behavior is the default for source files that don't have a .c extension, and when the /Tp or /TP option is specified. In C++ compilation mode, the compiler supports those parts of the ISO C99 and C11 standards that have been incorporated into the C++ standard. Almost all C code is also valid C++ code. A small number of C keywords and code constructs aren't valid C++ code, or are interpreted differently in C++. The compiler behaves according to the C++ standard in these cases. In C++ compilation mode, the /Za option may cause unexpected behavior and isn't recommended.
Other compiler options can affect how the compiler ensures standards conformance. For ways to specify specific standard C and C++ behavior settings, see the /Zc compiler option. For additional C++ standard conformance settings, see the /permissive- and /std compiler options.
For more information about conformance issues with Visual C++, see Nonstandard Behavior.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
In the navigation pane, choose Configuration Properties > C/C++ > Language.
Modify the Disable Language Extensions property.
To set this compiler option programmatically
See DisableLanguageExtensions.
See also
Cmake C99 Mode
Compiler Options
/Zc (Conformance)
/permissive- (Standards conformance)
/std (Specify Language Standard Version)
hello altogether,
my name is Wolfram Pagels, Berlin, Germany
my status is :retired but enthusiastic c++-fan;
I use Dev-C++ since 3 month ago; in the 70th I programmed in Fortran;
after a long break I enjoy to learn c++11;
e.g.: the day before yesterday I got the following message from Dev-C++:
My second question to you: * h o w to enable (these) options at my installed and running actual mingw compiler as part of Dev-C++ IDE ?
Thank you in advance for your time,
yours sincerely
- 4 Contributors
- forum 3 Replies
- 3,764 Views
- 23 Hours Discussion Span
- commentLatest Postby Ancient DragonLatest Post
Gcc C99
mike_2000_172,669
C99 Mode In Dev C++
Well, the answer to your problem (but not to your question) is to change your IDE. Dev-C++ is far too old to support C++11. The MinGW GCC version that ships with Dev-C++ is version 3.4.2, which is really old. Decent support for C++11 starts roughly from 4.6.0, but since it is still experimental, the newer the better. Currently, you can get 4.7.1 version through '>TDM-GCC ports. I recommend switching to '>CodeBlocks, which you can download as an installer that includes TDM-GCC 4.7.1. That should allow you to have decent C++11 support.
C99 Inline Function
As for setting compiler options, you typically have to navigate the 'Build Configuration' or 'Project Properties' or similar panels. Usually, you will find a place to put 'custom compiler options' where you can place the exact command-line compiler option (like -std=c++11
), that is, if you can't find a checkbox for the particular option you need.