Stephangerlach
asked on
Windows.h problem
Hi everyone
I got a problem with the windows.h file. i wrote only a simple programe and it gives me loads of errors.
#include <windows.h>
#include <iostream.h>
int main ( void )
{
cout << "hello";
return (0);
}
this gives me the following errors
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2143: syntax error : missing ';' before '__stdcall'
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2501: 'LRESULT' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2065: 'HWND' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2146: syntax error : missing ')' before identifier 'hwnd'
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2501: 'WndProc' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\basets d.h(22) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio\vc98\include\basets d.h(26) : error C2065: 'HINSTANCE' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\basets d.h(26) : error C2146: syntax error : missing ')' before identifier 'hInstance'
c:\program files\microsoft visual studio\vc98\include\basets d.h(26) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio\vc98\include\basets d.h(26) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio\vc98\include\basets d.h(27) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio\vc98\include\basets d.h(27) : error C2447: missing function header (old-style formal list?)
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2143: syntax error : missing ';' before '__stdcall'
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2501: 'LRESULT' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2086: 'LRESULT' : redefinition
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2146: syntax error : missing ')' before identifier 'hwnd'
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2501: 'WndProc' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2086: 'WndProc' : redefinition
c:\program files\microsoft visual studio\vc98\include\basets d.h(97) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio\vc98\include\basets d.h(98) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio\vc98\include\basets d.h(98) : error C2447: missing function header (old-style formal list?)
c:\program files\microsoft visual studio\vc98\include\winnt. h(1092) : error C2146: syntax error : missing ';' before identifier 'KSPIN_LOCK'
c:\program files\microsoft visual studio\vc98\include\winnt. h(1092) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
any idea why? i use windows XP and MS VS 6.0
I got a problem with the windows.h file. i wrote only a simple programe and it gives me loads of errors.
#include <windows.h>
#include <iostream.h>
int main ( void )
{
cout << "hello";
return (0);
}
this gives me the following errors
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\basets
c:\program files\microsoft visual studio\vc98\include\winnt.
c:\program files\microsoft visual studio\vc98\include\winnt.
Error executing cl.exe.
any idea why? i use windows XP and MS VS 6.0
ASKER
No there are no other parts before the first include. The code I posted is all i have. I had a problem in some other programe and we narrowed the problem down to the windows.h file. I used this code just as an example. But this code is all I have. And it still thows those errors at me
I tested it here using XP SP1 and VC++ 6.0 SP5 (or 6) and it compiles and executes as expected. So there could be some project options being the culprit. What defines are done in the project?
ASKER
I only used the standard settings in the project.
defines in the project: WIN32,_DEBUG,_CONSOLE,_MBC S
defines in the project: WIN32,_DEBUG,_CONSOLE,_MBC
ARe you using precompiled headers (stdafx.h)?
ASKER
i just changed the code to
#include <windows.h>
int main (void)
{
return(0);
}
and it gives me the 22 errors. Im not very good with c++ so i dont think im using precompiled headers.
#include <windows.h>
int main (void)
{
return(0);
}
and it gives me the 22 errors. Im not very good with c++ so i dont think im using precompiled headers.
Standard of VS C++ is using precompiled headers. The file view should list stdafx.h and stdafx.cpp in that case. To switch it off go at Project->Settings In the dialog select C++ tab and precompiled header category. Now you can change it to not use precompiled headers for the moment. Next rebuild all to assure that modified project settings are in effect.
The code you are posting here is not the origin of your problems. That compiles without any problems on my PC.
The code you are posting here is not the origin of your problems. That compiles without any problems on my PC.
ASKER
sorry to tell you but its still not working.
Any other idea? If not I think i will have to end up with reinstalling VC again.
Any other idea? If not I think i will have to end up with reinstalling VC again.
Instead of reinstalling VC I suppose to recreate a new clean project in its own folder.
ASKER
Did that too and the error is still there :@ its annoying me now
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I dont know why but the basetsd.h was something totally different. its working now. Thanks
#include <windows.h>
#include <iostream> // no .h here. Other version is deprecated.
int main ( void )
{
std::cout << "hello";
return (0);
}
But this doesn't solve the problem. From the last error message I assume that you have parts before those includes. And these seem to have some open parenthesis (inlcuding #ifdef without #endif)