Home Dashboard Directory Help
Search

void main() should give a warning by PlasticineGuy


Status: 

Closed
 as By Design Help for as By Design


3
0
Sign in
to vote
Type: Suggestion
ID: 537354
Opened: 2/28/2010 1:50:09 AM
Access Restriction: Public
0
Workaround(s)
view

Description

According to the ISO standard, main MUST return an int. So why does the compiler not even give a warning? I can see why you would let it slip through without an error, but even on /W4, void main does not give a warning. I think you should at least raise a warning if somebody attempts to use void main.

Also, I am using Visual Studio 2008 Express, but I do not see the option so I'll go with 2010 RC.
Details
Sign in to post a comment.
Posted by Microsoft on 3/21/2010 at 10:39 PM
Hi PlasticineGuy,

Thank you for this feedback. This behavior is by design. The windows.h header file is not /Za clean, and it is unlikely that this will ever change (nor would it be appropriate to fix). Unfortunately, you will need to choose between including windows.h or missing warnings on "void main()". Let me know if you have any other questions or comments.

Thanks,
Mark Roberts
Visual C++ Compiler Team
Posted by PlasticineGuy on 3/3/2010 at 11:34 PM
I have just realised /Za on any project that uses windows.h produces the following error log:
1>------ Build started: Project: dxhandlertext, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(171) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(172) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(172) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(171) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(173) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(173) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(172) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(174) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(174) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(173) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(175) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(175) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(174) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(176) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(176) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(175) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(177) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(177) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(176) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(178) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(178) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(177) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(6) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(10) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings.h(178) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(14) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(14) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(10) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : error C2144: syntax error : 'char' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : error C2144: syntax error : 'char' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(17) : error C2628: 'TCHAR' followed by 'char' is illegal (did you forget a ';'?)
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(17) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(17) : error C2144: syntax error : 'unsigned short' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(17) : error C2378: 'compname_props' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : see declaration of 'compname_props'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(18) : error C2628: 'TCHAR' followed by 'char' is illegal (did you forget a ';'?)
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(18) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(18) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(18) : error C2378: 'compname_props' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : see declaration of 'compname_props'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2628: 'TCHAR' followed by 'char' is illegal (did you forget a ';'?)
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2146: syntax error : missing ';' before identifier 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2378: 'compname_props' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : see declaration of 'compname_props'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2628: 'TCHAR' followed by 'char' is illegal (did you forget a ';'?)
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C2377: 'TCHAR' : redefinition; typedef cannot be overloaded with any other symbol
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : see declaration of 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2144: syntax error : 'char' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2370: 'TCHAR' : redefinition; different storage class
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : see declaration of 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2086: 'char compname_props' : redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(16) : see declaration of 'compname_props'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2144: syntax error : 'char' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2373: 'TCHAR' : redefinition; different type modifiers
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : see declaration of 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C2371: 'TCHAR' : redefinition; different basic types
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : see declaration of 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(21) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(22) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(1) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(2) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(3) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(4) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(5) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(6) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(7) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_undef.h(8) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1011) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1012) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1014) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1011) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1015) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1015) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1014) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1021) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1021) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1015) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1023) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1023) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1021) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1024) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1024) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1023) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1025) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1025) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1024) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1026) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1026) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1025) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1027) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1027) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1026) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1028) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1028) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1027) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1029) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1029) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1028) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1030) : error C2008: '$' : unexpected in macro definition
1>c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1030) : warning C4005: '__' : macro redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_strict.h(1029) : see previous definition of '__'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : error C2146: syntax error : missing ';' before identifier 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : error C2146: syntax error : missing ';' before identifier 'WCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C2146: syntax error : missing ';' before identifier 'PWSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C2040: 'PWSTR' : 'int' differs in levels of indirection from 'WCHAR *'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(298) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C2373: 'PWSTR' : redefinition; different type modifiers
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'PWSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(299) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(300) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(300) : error C2146: syntax error : missing ';' before identifier 'WCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(300) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(301) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(301) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(301) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C2146: syntax error : missing ';' before identifier 'PCWSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C2040: 'PCWSTR' : 'int' differs in levels of indirection from 'const WCHAR *'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(302) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(303) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(303) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(303) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(356) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(356) : error C2146: syntax error : missing ';' before identifier 'CHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(356) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C2146: syntax error : missing ';' before identifier 'PSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C2040: 'PSTR' : 'int' differs in levels of indirection from 'CHAR *'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(357) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C2373: 'PSTR' : redefinition; different type modifiers
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(356) : see declaration of 'PSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(358) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(359) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(359) : error C2143: syntax error : missing ';' before 'const'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(359) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C2018: unknown character '0x24'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C2146: syntax error : missing ';' before identifier 'PCSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C2378: 'allowed_on_typedecl' : redefinition; symbol cannot be overloaded with a typedef
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(297) : see declaration of 'allowed_on_typedecl'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C2143: syntax error : missing ';' before '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C2040: 'PCSTR' : 'int' differs in levels of indirection from 'const CHAR *'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(360) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(384) : error C2371: 'TCHAR' : redefinition; different basic types
1>        c:\program files\microsoft sdks\windows\v6.0a\include\specstrings_adt.h(19) : see declaration of 'TCHAR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(390) : error C2146: syntax error : missing ';' before identifier 'PTSTR'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(390) : fatal error C1003: error count exceeds 100; stopping compilation
1>Build log was saved at "file://c:\Users\helen\Documents\Visual Studio 2008\Projects\dxhandlertext\dxhandlertext\Debug\BuildLog.htm"
1>dxhandlertext - 121 error(s), 30 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please fix this!
Posted by PlasticineGuy on 3/1/2010 at 9:04 PM
Thanks Jonathan; I was not aware of the /Za option.
Posted by Microsoft on 3/1/2010 at 10:39 AM
Hi: if you compiler the code in strict mode (/Za) you do get a warning:

warning C4326: return type of 'main' should be 'int' instead of 'void'

Note: we don't give the warning in non-strict mode as unfortunately this is a very common C++ 'mistake'.

Jonathan Caves
Visual C++ Compiler Team

Posted by Microsoft on 3/1/2010 at 1:28 AM
Thank you for your feedback, we are currently reviewing the feedback you have submitted.
Sign in to post a workaround.