Compile errors in string.h after upgrade to SP1

My program worked perfectly before the upgrade.

Now I get:

Build started: Project: hwa_dwa, Configuration: Debug Win32

Compiling...

configure.cpp

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : warning C4091: '' : ignored on left of 'char' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2144: syntax error : 'char' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2144: syntax error : 'char' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : warning C4091: '' : ignored on left of 'char' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2059: syntax error : ')'

Any ideas?

Thanks,

Tim

[5082 byte] By [Tim_encinitas] at [2007-12-28]
# 1

I spent some time trying to find the simplest version that would reproduce the problem. It turns out to be very simple indeed! All you have to do is include "string.h":

#include <string.h>

int main()

{

return 0;

}

The compile command line is:

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /Gm /EHsc /RTC1 /MTd /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo /c /Wp64 /ZI /TP /errorReport:prompt

and the result is:

Build started: Project: hello, Configuration: Debug Win32

Compiling...

hello.cpp

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : warning C4091: '' : ignored on left of 'char' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(136) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2144: syntax error : 'char' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2144: syntax error : 'char' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : warning C4091: '' : ignored on left of 'char' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(175) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(296) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(303) : error C2059: syntax error : ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2144: syntax error : 'wchar_t' should be preceded by ')'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2144: syntax error : 'wchar_t' should be preceded by ';'

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : warning C4091: '' : ignored on left of 'wchar_t' when no variable is declared

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2143: syntax error : missing ';' before ','

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2059: syntax error : ','

c:\program files\microsoft visual studio 8\vc\include\string.h(309) : error C2059: syntax error : ')'

Build log was saved at "file://c:\systemc\systemc-2.2.05jun06_beta\hello\hello\Debug\BuildLog.htm"

hello - 25 error(s), 10 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Thanks,

Tim

Tim_encinitas at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 2

The ".h" is depreciated. Just type:

#include <string>

Can you post your full code?

Abcidefugian at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 3

Hi-

Thanks for the reply. I tried #include <string> without the '.h' - same results.

Not sure what you mean by my 'full code'. My 'real' program is many files. However, the 3-line program above produces the same problem, and the 3 lines are the whole program.

One thing I just found that does fix the problem (with the 3-line program) - if I add to the 'Additional Include directories' a path to the \include\crt of the 'Microsoft Platform SDK', it works. Looks like there is a 'string.h' in both the SDK and in the 'Microsoft Visual Studio 8\VC\include', and they are not the same. The one in the SDK is only 8KB, and the other one is 27 KB. Anyone know why this should be?

When I get a chance, I'll see if the same change fixes my real program as well.

Thanks,

Tim

Tim_encinitas at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 4

Well, the 'solution' I described above does not work with my real program. I get a bunch of errors like:

c:\systemc\systemc-2.2.05jun06_beta\src\systemc.h(109) : error C2039: 'fopen' : is not a member of 'std'

It seems like the include dependancies are getting messed up.

If I go back to not using the SDK string.h, but comment out the lines the compiler dislikes (inside 'Microsoft Visual Studio 8\VC\include\string.h'), then everything works. A bit of a kludge - most likely will not work in the long term. The compiler is always complaining about the "CPP_OVERLOAD_STANDARD_FUNC_0_1_EX" - and there is always a similar 'CPP_OVERLOAD_STANDARD_FUNC_0_0' definition close by. Not sure what these really mean, but maybe it is a clue to someone.

Thanks,

Tim

Tim_encinitas at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 5
It sounds like you're having a problem with vc\include\crtdefs.h. Mine is dated 12/01/06, 22:54. Make sure you're not picking up a copy from another directory; Project + properties, C/C++, Advanced, Show Includes = Yes. Rebuild.
nobugz at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 6

Hi Hans-

Thanks for the reply. 'crtdefs.h' rang a bell - I remember that I modified it to define _CRT_SECURE_NO_DEPRECATE before I upgraded to SP1 (this was before I realized you can define variables in the 'preprocessor' section of the project settings). While trying to fix this problem, I did try to remove this change, to no avail.

However, I just un-installed Express VC++, and re-installed it along with SP1 - now it works.

So, either I screwed up when I undid my change, or maybe having a modified crtdefs.h confused the upgrade tool?

Anyway, it works now.

Thanks

Tim

Tim_encinitas at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 7

I just installed VS 2005 SP1, and I am experiencing the same problem that Tim describes above. The compile warning/error is as follows:

1>Compiling...

1>Stdafx.cpp

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ')'

The stdafx.cpp includes the stdafx.h file, which inturn includes <windows.h>. The project mixes both managed and unmanaged code (it is configured with Common Languange Runtime support).

It compiled successfully prior to SP1 being installed.

EMattP at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 8

I compiled with the "Show Includes" enabled, and the include location for the crtdef.h file is the following:

1>Note: including file: C:\Program Files\Microsoft Visual Studio 8\VC\include\crtdefs.h

Also, the entire warning/error list is the following:

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : warning C4002: too many actual parameters for macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX'

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ')'

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2144: syntax error : 'char' should be preceded by ';'

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : warning C4091: '' : ignored on left of 'char' when no variable is declared

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2143: syntax error : missing ';' before ','

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2059: syntax error : ','

1>C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(136) : error C2059: syntax error : ')'

EMattP at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 9

Still seems something wrong with the hearders. See other post (http://groups.google.com/group/microsoft.public.dotnet.languages.vc/msg/61c295c9ec5b6abc?hl=en&)

-Igor

okigan at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...
# 10
I also suffered from this problem immediately after upgrading to SP1 - I think I must have accidentally saved the string.h file when it had opened due to debugging a failure.

Repairing the installation and re installing SP1 had no effect; however once I renamed the string.h file to string.h.bad, and re-ran the SP1 installer (without re-installing anything), the string.h file was correctly copied from the installer to my directory, and all the compile problems went away. I was prompted that SP1 was already installed and did I want to install anyway - to which I said yes.

Hope this helps other people...

MrCranky at 2007-9-4 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...